1. 25 May, 2016 4 commits
  2. 04 Apr, 2016 1 commit
    • Kirill A. Shutemov's avatar
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov authored
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      This promise never materialized.  And unlikely will.
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      Let's stop pretending that pages in page cache are special.  They are
      The changes are pretty straight-forward:
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
       - page_cache_get() -> get_page();
       - page_cache_release() -> put_page();
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      virtual patch
      expression E;
      + E
      expression E;
      + E
      + PAGE_SHIFT
      + PAGE_SIZE
      + PAGE_MASK
      expression E;
      + PAGE_ALIGN(E)
      expression E;
      - page_cache_get(E)
      + get_page(E)
      expression E;
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  3. 04 Mar, 2016 1 commit
  4. 02 Nov, 2015 1 commit
  5. 08 Sep, 2015 1 commit
  6. 25 Jun, 2015 8 commits
    • Yan, Zheng's avatar
      ceph: rework dcache readdir · fdd4e158
      Yan, Zheng authored
      Previously our dcache readdir code relies on that child dentries in
      directory dentry's d_subdir list are sorted by dentry's offset in
      descending order. When adding dentries to the dcache, if a dentry
      already exists, our readdir code moves it to head of directory
      dentry's d_subdir list. This design relies on dcache internals.
      Al Viro suggests using ncpfs's approach: keeping array of pointers
      to dentries in page cache of directory inode. the validity of those
      pointers are presented by directory inode's complete and ordered
      flags. When a dentry gets pruned, we clear directory inode's complete
      flag in the d_prune() callback. Before moving a dentry to other
      directory, we clear the ordered flag for both old and new directory.
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
    • Yan, Zheng's avatar
      ceph: track pending caps flushing globally · 8310b089
      Yan, Zheng authored
      So we know TID of the oldest pending caps flushing. Later patch will
      send this information to MDS, so that MDS can trim its completed caps
      flush list.
      Tracking pending caps flushing globally also simplifies syncfs code.
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
    • Yan, Zheng's avatar
      ceph: track pending caps flushing accurately · 553adfd9
      Yan, Zheng authored
      Previously we do not trace accurate TID for flushing caps. when
      MDS failovers, we have no choice but to re-send all flushing caps
      with a new TID. This can cause problem because MDS can has already
      flushed some caps and has issued the same caps to other client.
      The re-sent cap flush has a new TID, which makes MDS unable to
      detect if it has already processed the cap flush.
      This patch adds code to track pending caps flushing accurately.
      When re-sending cap flush is needed, we use its original flush
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
    • Ilya Dryomov's avatar
      libceph: store timeouts in jiffies, verify user input · a319bf56
      Ilya Dryomov authored
      There are currently three libceph-level timeouts that the user can
      specify on mount: mount_timeout, osd_idle_ttl and osdkeepalive.  All of
      these are in seconds and no checking is done on user input: negative
      values are accepted, we multiply them all by HZ which may or may not
      overflow, arbitrarily large jiffies then get added together, etc.
      There is also a bug in the way mount_timeout=0 is handled.  It's
      supposed to mean "infinite timeout", but that's not how wait.h APIs
      treat it and so __ceph_open_session() for example will busy loop
      without much chance of being interrupted if none of ceph-mons are
      Fix all this by verifying user input, storing timeouts capped by
      msecs_to_jiffies() in jiffies and using the new ceph_timeout_jiffies()
      helper for all user-specified waits to handle infinite timeouts
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Reviewed-by: default avatarAlex Elder <elder@linaro.org>
    • Yan, Zheng's avatar
      ceph: exclude setfilelock requests when calculating oldest tid · e8a7b8b1
      Yan, Zheng authored
      setfilelock requests can block for a long time, which can prevent
      client from advancing its oldest tid.
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
    • Yan, Zheng's avatar
      ceph: don't pre-allocate space for cap release messages · 745a8e3b
      Yan, Zheng authored
      Previously we pre-allocate cap release messages for each caps. This
      wastes lots of memory when there are large amount of caps. This patch
      make the code not pre-allocate the cap release messages. Instead,
      we add the corresponding ceph_cap struct to a list when releasing a
      cap. Later when flush cap releases is needed, we allocate the cap
      release messages dynamically.
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
    • Yan, Zheng's avatar
      ceph: make sure syncfs flushes all cap snaps · affbc19a
      Yan, Zheng authored
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
    • Yan, Zheng's avatar
      ceph: check OSD caps before read/write · 10183a69
      Yan, Zheng authored
      Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
  7. 19 Feb, 2015 2 commits
  8. 17 Dec, 2014 3 commits
  9. 14 Oct, 2014 2 commits
  10. 05 Jun, 2014 1 commit
    • Sage Weil's avatar
      ceph: include time stamp in every MDS request · b8e69066
      Sage Weil authored
      We recently modified the client/MDS protocol to include a timestamp in the
      client request.  This allows ctime updates to follow the client's clock
      in most cases, which avoids subtle problems when clocks are out of sync
      and timestamps are updated sometimes by the MDS clock (for most requests)
      and sometimes by the client clock (for cap writeback).
      Signed-off-by: default avatarSage Weil <sage@inktank.com>
  11. 04 Apr, 2014 1 commit
  12. 21 Jan, 2014 1 commit
  13. 23 Nov, 2013 1 commit
  14. 12 Feb, 2013 1 commit
  15. 17 Jan, 2013 1 commit
    • Sam Lang's avatar
      ceph: Check for created flag in response from mds · 6e8575fa
      Sam Lang authored
      The mds now sends back a created inode if the create request
      performed the create.  If the file already existed, no inode is
      returned in the reply.  This allows ceph to set the created flag
      in atomic_open so that permissions are properly checked in the case
      that the file wasn't created by the create call to the mds.
      To ensure compability with previous kernels, a feature for sending
      back the inode in the create reply was added, so that the mds will
      only send back the inode if the client indicates it supports the
      Signed-off-by: default avatarSam Lang <sam.lang@inktank.com>
      Reviewed-by: default avatarSage Weil <sage@inktank.com>
  16. 17 May, 2012 1 commit
  17. 02 Feb, 2012 1 commit
    • Alex Elder's avatar
      ceph: create a new session lock to avoid lock inversion · d8fb02ab
      Alex Elder authored
      Lockdep was reporting a possible circular lock dependency in
      dentry_lease_is_valid().  That function needs to sample the
      session's s_cap_gen and and s_cap_ttl fields coherently, but needs
      to do so while holding a dentry lock.  The s_cap_lock field was
      being used to protect the two fields, but that can't be taken while
      holding a lock on a dentry within the session.
      In most cases, the s_cap_gen and s_cap_ttl fields only get operated
      on separately.  But in three cases they need to be updated together.
      Implement a new lock to protect the spots updating both fields
      atomically is required.
      Signed-off-by: default avatarAlex Elder <elder@dreamhost.com>
      Reviewed-by: default avatarSage Weil <sage@newdream.net>
  18. 07 Dec, 2011 1 commit
    • Sage Weil's avatar
      ceph: use i_ceph_lock instead of i_lock · be655596
      Sage Weil authored
      We have been using i_lock to protect all kinds of data structures in the
      ceph_inode_info struct, including lists of inodes that we need to iterate
      over while avoiding races with inode destruction.  That requires grabbing
      a reference to the inode with the list lock protected, but igrab() now
      takes i_lock to check the inode flags.
      Changing the list lock ordering would be a painful process.
      However, using a ceph-specific i_ceph_lock in the ceph inode instead of
      i_lock is a simple mechanical change and avoids the ordering constraints
      imposed by igrab().
      Reported-by: default avatarAmon Ott <a.ott@m-privacy.de>
      Signed-off-by: default avatarSage Weil <sage@newdream.net>
  19. 26 Jul, 2011 2 commits
  20. 24 May, 2011 1 commit
    • Sage Weil's avatar
      ceph: fix cap flush race reentrancy · db354052
      Sage Weil authored
      In e9964c10 we change cap flushing to do a delicate dance because some
      inodes on the cap_dirty list could be in a migrating state (got EXPORT but
      not IMPORT) in which we couldn't actually flush and move from
      dirty->flushing, breaking the while (!empty) { process first } loop
      structure.  It worked for a single sync thread, but was not reentrant and
      triggered infinite loops when multiple syncers came along.
      Instead, move inodes with dirty to a separate cap_dirty_migrating list
      when in the limbo export-but-no-import state, allowing us to go back to
      the simple loop structure (which was reentrant).  This is cleaner and more
      Audited the cap_dirty users and this looks fine:
      list_empty(&ci->i_dirty_item) is still a reliable indicator of whether we
      have dirty caps (which list we're on is irrelevant) and list_del_init()
      calls still do the right thing.
      Signed-off-by: default avatarSage Weil <sage@newdream.net>
  21. 12 Jan, 2011 2 commits
    • Sage Weil's avatar
      ceph: drop redundant r_mds field · 4af25fdd
      Sage Weil authored
      The r_mds field is redundant, since we can find the same information at
      r_session->s_mds, and when r_session is NULL then r_mds is meaningless.
      Signed-off-by: default avatarSage Weil <sage@newdream.net>
    • Sage Weil's avatar
      ceph: implement DIRLAYOUTHASH feature to get dir layout from MDS · 14303d20
      Sage Weil authored
      This implements the DIRLAYOUTHASH protocol feature, which passes the dir
      layout over the wire from the MDS.  This gives the client knowledge
      of the correct hash function to use for mapping dentries among dir
      Note that if this feature is _not_ present on the client but is on the
      MDS, the client may misdirect requests.  This will result in a forward
      and degrade performance.  It may also result in inaccurate NFS filehandle
      generation, which will prevent fh resolution when the inode is not present
      in the client cache and the parent directories have been fragmented.
      Signed-off-by: default avatarSage Weil <sage@newdream.net>
  22. 01 Dec, 2010 1 commit
  23. 08 Nov, 2010 1 commit
    • Sage Weil's avatar
      ceph: fix uid/gid on resent mds requests · cb4276cc
      Sage Weil authored
      MDS requests can be rebuilt and resent in non-process context, but were
      filling in uid/gid from current_fsuid/gid.  Put that information in the
      request struct on request setup.
      This fixes incorrect (and root) uid/gid getting set for requests that
      are forwarded between MDSs, usually due to metadata migrations.
      Signed-off-by: default avatarSage Weil <sage@newdream.net>
  24. 20 Oct, 2010 1 commit
    • Yehuda Sadeh's avatar
      ceph: factor out libceph from Ceph file system · 3d14c5d2
      Yehuda Sadeh authored
      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
      No functional change, aside from some subtle error handling cases that got
      cleaned up in the refactoring process.
      Signed-off-by: default avatarSage Weil <sage@newdream.net>