1. 21 10月, 2010 2 次提交
    • S
      ceph: do not hide .snap in root directory · 4c32f5dd
      Sage Weil 提交于
      Snaps in the root directory are now supported by the MDS, and harmless on
      older versions.
      Signed-off-by: NSage Weil <sage@newdream.net>
      4c32f5dd
    • Y
      ceph: factor out libceph from Ceph file system · 3d14c5d2
      Yehuda Sadeh 提交于
      This factors out protocol and low-level storage parts of ceph into a
      separate libceph module living in net/ceph and include/linux/ceph.  This
      is mostly a matter of moving files around.  However, a few key pieces
      of the interface change as well:
      
       - ceph_client becomes ceph_fs_client and ceph_client, where the latter
         captures the mon and osd clients, and the fs_client gets the mds client
         and file system specific pieces.
       - Mount option parsing and debugfs setup is correspondingly broken into
         two pieces.
       - The mon client gets a generic handler callback for otherwise unknown
         messages (mds map, in this case).
       - The basic supported/required feature bits can be expanded (and are by
         ceph_fs_client).
      
      No functional change, aside from some subtle error handling cases that got
      cleaned up in the refactoring process.
      Signed-off-by: NSage Weil <sage@newdream.net>
      3d14c5d2
  2. 12 9月, 2010 1 次提交
    • S
      ceph: fix null pointer deref on anon root dentry release · ca04d9c3
      Sage Weil 提交于
      When we release a root dentry, particularly after a splice, the parent
      (actually our) inode was evaluating to NULL and was getting dereferenced
      by ceph_snap().  This is reproduced by something as simple as
      
       mount -t ceph monhost:/a/b mnt
       mount -t ceph monhost:/a mnt2
       ls mnt2
      
      A splice_dentry() would kill the old 'b' inode's root dentry, and we'd
      crash while releasing it.
      
      Fix by checking for both the ROOT and NULL cases explicitly.  We only need
      to invalidate the parent dir when we have a correct parent to invalidate.
      Signed-off-by: NSage Weil <sage@newdream.net>
      ca04d9c3
  3. 25 8月, 2010 1 次提交
  4. 04 8月, 2010 1 次提交
  5. 02 8月, 2010 1 次提交
  6. 24 7月, 2010 1 次提交
    • S
      ceph: fix d_release dop for snapdir, snapped dentries · 252af521
      Sage Weil 提交于
      We need to set the d_release dop for snapdir and snapped dentries so that
      the ceph_dentry_info struct gets released.  We also use the dcache to
      cache readdir results when possible, which only works if we know when
      dentries are dropped from the cache.  Since we don't use the dcache for
      readdir in the hidden snapdir, avoid that case in ceph_dentry_release.
      Signed-off-by: NSage Weil <sage@newdream.net>
      252af521
  7. 23 7月, 2010 1 次提交
  8. 30 5月, 2010 1 次提交
    • J
      fs/ceph: Use ERR_CAST · 7e34bc52
      Julia Lawall 提交于
      Use ERR_CAST(x) rather than ERR_PTR(PTR_ERR(x)).  The former makes more
      clear what is the purpose of the operation, which otherwise looks like a
      no-op.
      
      In the case of fs/ceph/inode.c, ERR_CAST is not needed, because the type of
      the returned value is the same as the type of the enclosing function.
      
      The semantic patch that makes this change is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      type T;
      T x;
      identifier f;
      @@
      
      T f (...) { <+...
      - ERR_PTR(PTR_ERR(x))
      + x
       ...+> }
      
      @@
      expression x;
      @@
      
      - ERR_PTR(PTR_ERR(x))
      + ERR_CAST(x)
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NSage Weil <sage@newdream.net>
      7e34bc52
  9. 28 5月, 2010 1 次提交
  10. 18 5月, 2010 6 次提交
  11. 04 5月, 2010 1 次提交
    • S
      ceph: clear dir complete, invalidate dentry on replayed rename · ea1409f9
      Sage Weil 提交于
      If a rename operation is resent to the MDS following an MDS restart, the
      client does not get a full reply (containing the resulting metadata) back.
      In that case, a ceph_rename() needs to compensate by doing anything useful
      that fill_inode() would have, like d_move().
      
      It also needs to invalidate the dentry (to workaround the vfs_rename_dir()
      bug) and clear the dir complete flag, just like fill_trace().
      Signed-off-by: NSage Weil <sage@newdream.net>
      ea1409f9
  12. 14 4月, 2010 1 次提交
  13. 13 4月, 2010 1 次提交
  14. 31 3月, 2010 1 次提交
    • S
      ceph: fix dentry rehashing on virtual .snap dir · 9358c6d4
      Sage Weil 提交于
      If a lookup fails on the magic .snap directory, we bind it to a magic
      snap directory inode in ceph_lookup_finish().  That code assumes the dentry
      is unhashed, but a recent server-side change started returning NULL leases
      on lookup failure, causing the .snap dentry to be hashed and NULL by
      ceph_fill_trace().
      
      This causes dentry hash chain corruption, or a dies when d_rehash()
      includes
      	BUG_ON(!d_unhashed(entry));
      
      So, avoid processing the NULL dentry lease if it the dentry matches the
      snapdir name in ceph_fill_trace().  That allows the lookup completion to
      properly bind it to the snapdir inode.  BUG there if dentry is hashed to
      be sure.
      Signed-off-by: NSage Weil <sage@newdream.net>
      9358c6d4
  15. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  16. 23 3月, 2010 1 次提交
  17. 24 12月, 2009 1 次提交
  18. 22 12月, 2009 1 次提交
  19. 04 12月, 2009 1 次提交
  20. 12 11月, 2009 1 次提交
  21. 28 10月, 2009 1 次提交
  22. 07 10月, 2009 1 次提交
    • S
      ceph: directory operations · 2817b000
      Sage Weil 提交于
      Directory operations, including lookup, are defined here.  We take
      advantage of lookup intents when possible.  For the most part, we just
      need to build the proper requests for the metadata server(s) and
      pass things off to the mds_client.
      
      The results of most operations are normally incorporated into the
      client's cache when the reply is parsed by ceph_fill_trace().
      However, if the MDS replies without a trace (e.g., when retrying an
      update after an MDS failure recovery), some operation-specific cleanup
      may be needed.
      
      We can validate cached dentries in two ways.  A per-dentry lease may
      be issued by the MDS, or a per-directory cap may be issued that acts
      as a lease on the entire directory.  In the latter case, a 'gen' value
      is used to determine which dentries belong to the currently leased
      directory contents.
      
      We normally prepopulate the dcache and icache with readdir results.
      This makes subsequent lookups and getattrs avoid any server
      interaction.  It also lets us satisfy readdir operation by peeking at
      the dcache IFF we hold the per-directory cap/lease, previously
      performed a readdir, and haven't dropped any of the resulting
      dentries.
      Signed-off-by: NSage Weil <sage@newdream.net>
      2817b000