1. 22 4月, 2015 1 次提交
  2. 20 4月, 2015 3 次提交
  3. 23 2月, 2015 1 次提交
    • D
      VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) · e36cb0b8
      David Howells 提交于
      Convert the following where appropriate:
      
       (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
      
       (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
      
       (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
           complicated than it appears as some calls should be converted to
           d_can_lookup() instead.  The difference is whether the directory in
           question is a real dir with a ->lookup op or whether it's a fake dir with
           a ->d_automount op.
      
      In some circumstances, we can subsume checks for dentry->d_inode not being
      NULL into this, provided we the code isn't in a filesystem that expects
      d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
      use d_inode() rather than d_backing_inode() to get the inode pointer).
      
      Note that the dentry type field may be set to something other than
      DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
      manages the fall-through from a negative dentry to a lower layer.  In such a
      case, the dentry type of the negative union dentry is set to the same as the
      type of the lower dentry.
      
      However, if you know d_inode is not NULL at the call site, then you can use
      the d_is_xxx() functions even in a filesystem.
      
      There is one further complication: a 0,0 chardev dentry may be labelled
      DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
      intended for special directory entry types that don't have attached inodes.
      
      The following perl+coccinelle script was used:
      
      use strict;
      
      my @callers;
      open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
          die "Can't grep for S_ISDIR and co. callers";
      @callers = <$fd>;
      close($fd);
      unless (@callers) {
          print "No matches\n";
          exit(0);
      }
      
      my @cocci = (
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISLNK(E->d_inode->i_mode)',
          '+ d_is_symlink(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISDIR(E->d_inode->i_mode)',
          '+ d_is_dir(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISREG(E->d_inode->i_mode)',
          '+ d_is_reg(E)' );
      
      my $coccifile = "tmp.sp.cocci";
      open($fd, ">$coccifile") || die $coccifile;
      print($fd "$_\n") || die $coccifile foreach (@cocci);
      close($fd);
      
      foreach my $file (@callers) {
          chomp $file;
          print "Processing ", $file, "\n";
          system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
      	die "spatch failed";
      }
      
      [AV: overlayfs parts skipped]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e36cb0b8
  4. 19 2月, 2015 3 次提交
    • Y
      ceph: return error for traceless reply race · 4d41cef2
      Yan, Zheng 提交于
      When we receives traceless reply for request that created new inode,
      we re-send a lookup request to MDS get information of the newly created
      inode. (VFS expects FS' callback return an inode in create case)
      This breaks one request into two requests. Other client may modify or
      move to the new inode in the middle.
      
      When the race happens, ceph_handle_notrace_create() unconditionally
      links the dentry for 'create' operation to the inode returned by lookup.
      This may confuse VFS when the inode is a directory (VFS does not allow
      multiple linkages for directory inode).
      
      This patch makes ceph_handle_notrace_create() when it detect a race.
      This event should be rare and it happens only when we talk to old MDS.
      Recent MDS does not send traceless reply for request that creates new
      inode.
      Signed-off-by: NYan, Zheng <zyan@redhat.com>
      4d41cef2
    • Y
      ceph: fix dentry leaks · 5cba372c
      Yan, Zheng 提交于
      Signed-off-by: NYan, Zheng <zyan@redhat.com>
      5cba372c
    • Y
      ceph: provide seperate {inode,file}_operations for snapdir · 38c48b5f
      Yan, Zheng 提交于
      remove all unsupported operations from {inode,file}_operations.
      Signed-off-by: NYan, Zheng <zyan@redhat.com>
      38c48b5f
  5. 18 12月, 2014 2 次提交
    • Y
      ceph: fix mksnap crash · 275dd19e
      Yan, Zheng 提交于
      mksnap reply only contain 'target', does not contain 'dentry'. So
      it's wrong to use req->r_reply_info.head->is_dentry to detect traceless
      reply.
      Signed-off-by: NYan, Zheng <zyan@redhat.com>
      Reviewed-by: NSage Weil <sage@redhat.com>
      275dd19e
    • Y
      ceph: introduce a new inode flag indicating if cached dentries are ordered · 70db4f36
      Yan, Zheng 提交于
      After creating/deleting/renaming file, offsets of sibling dentries may
      change. So we can not use cached dentries to satisfy readdir. But we can
      still use the cached dentries to conclude -ENOENT for lookup.
      
      This patch introduces a new inode flag indicating if child dentries are
      ordered. The flag is set at the same time marking a directory complete.
      After creating/deleting/renaming file, we clear the flag on directory
      inode. This prevents ceph_readdir() from using cached dentries to satisfy
      readdir syscall.
      Signed-off-by: NYan, Zheng <zyan@redhat.com>
      70db4f36
  6. 20 11月, 2014 2 次提交
  7. 04 11月, 2014 1 次提交
  8. 15 10月, 2014 1 次提交
  9. 09 10月, 2014 1 次提交
  10. 29 4月, 2014 3 次提交
  11. 07 4月, 2014 1 次提交
  12. 05 4月, 2014 1 次提交
  13. 03 4月, 2014 5 次提交
  14. 18 2月, 2014 2 次提交
  15. 30 1月, 2014 1 次提交
  16. 21 1月, 2014 1 次提交
  17. 01 1月, 2014 1 次提交
  18. 01 10月, 2013 1 次提交
  19. 10 8月, 2013 1 次提交
  20. 29 6月, 2013 1 次提交
  21. 02 5月, 2013 2 次提交
    • Y
      ceph: use i_release_count to indicate dir's completeness · 2f276c51
      Yan, Zheng 提交于
      Current ceph code tracks directory's completeness in two places.
      ceph_readdir() checks i_release_count to decide if it can set the
      I_COMPLETE flag in i_ceph_flags. All other places check the I_COMPLETE
      flag. This indirection introduces locking complexity.
      
      This patch adds a new variable i_complete_count to ceph_inode_info.
      Set i_release_count's value to it when marking a directory complete.
      By comparing the two variables, we know if a directory is complete
      Signed-off-by: NYan, Zheng <zheng.z.yan@intel.com>
      2f276c51
    • Y
      ceph: use I_COMPLETE inode flag instead of D_COMPLETE flag · a8673d61
      Yan, Zheng 提交于
      commit c6ffe100 moved the flag that tracks if the dcache contents
      for a directory are complete to dentry. The problem is there are
      lots of places that use ceph_dir_{set,clear,test}_complete() while
      holding i_ceph_lock. but ceph_dir_{set,clear,test}_complete() may
      sleep because they call dput().
      
      This patch basically reverts that commit. For ceph_d_prune(), it's
      called with both the dentry to prune and the parent dentry are
      locked. So it's safe to access the parent dentry's d_inode and
      clear I_COMPLETE flag.
      Signed-off-by: NYan, Zheng <zheng.z.yan@intel.com>
      Reviewed-by: NGreg Farnum <greg@inktank.com>
      Reviewed-by: NSage Weil <sage@inktank.com>
      a8673d61
  22. 23 2月, 2013 1 次提交
  23. 18 12月, 2012 1 次提交
  24. 03 8月, 2012 1 次提交
    • S
      ceph: simplify+fix atomic_open · 5ef50c3b
      Sage Weil 提交于
      The initial ->atomic_open op was carried over from the old intent code,
      which was incomplete and didn't really work.  Replace it with a fresh
      method.  In particular:
      
       * always attempt to do an atomic open+lookup, both for the create case
         and for lookups of existing files.
       * fix symlink handling by returning 1 to the VFS so that we can follow
         the link to its destination. This fixes a longstanding ceph bug (#2392).
      Signed-off-by: NSage Weil <sage@inktank.com>
      5ef50c3b
  25. 31 7月, 2012 1 次提交
  26. 14 7月, 2012 1 次提交