“561c54460c24a0d08ee9d6c5ea4d7daf535b2aff”上不存在“doc/doc_ch/detection.md”
  1. 09 5月, 2016 1 次提交
    • A
      nfs: per-name sillyunlink exclusion · 884be175
      Al Viro 提交于
      use d_alloc_parallel() for sillyunlink/lookup exclusion and
      explicit rwsem (nfs_rmdir() being a writer and nfs_call_unlink() -
      a reader) for rmdir/sillyunlink one.
      
      That ought to make lookup/readdir/!O_CREAT atomic_open really
      parallel on NFS.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      884be175
  2. 03 5月, 2016 1 次提交
  3. 05 4月, 2016 1 次提交
    • K
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov 提交于
      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
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - 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 << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(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: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  4. 27 3月, 2016 1 次提交
  5. 14 3月, 2016 1 次提交
  6. 23 1月, 2016 1 次提交
    • A
      wrappers for ->i_mutex access · 5955102c
      Al Viro 提交于
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  7. 15 1月, 2016 1 次提交
    • A
      Make sure that highmem pages are not added to symlink page cache · e8ecde25
      Al Viro 提交于
      inode_nohighmem() is sufficient to make sure that page_get_link()
      won't try to allocate a highmem page.  Moreover, it is sufficient
      to make sure that page_symlink/__page_symlink won't do the same
      thing.  However, any filesystem that manually preseeds the symlink's
      page cache upon symlink(2) needs to make sure that the page it
      inserts there won't be a highmem one.
      
      Fortunately, only nfs and shmem have run afoul of that...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e8ecde25
  8. 29 12月, 2015 2 次提交
  9. 04 11月, 2015 1 次提交
  10. 18 8月, 2015 2 次提交
  11. 01 7月, 2015 1 次提交
  12. 24 6月, 2015 1 次提交
  13. 24 4月, 2015 1 次提交
    • B
      NFS: Don't attempt to decode missing directory entries · ce85cfbe
      Benjamin Coddington 提交于
      If a READDIR reply comes back without any page data, avoid a NULL pointer
      dereference in xdr_copy_to_scratch().
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
      IP: [<ffffffff813a378d>] memcpy+0xd/0x110
      ...
      Call Trace:
      	? xdr_inline_decode+0x7a/0xb0 [sunrpc]
      	nfs3_decode_dirent+0x73/0x320 [nfsv3]
      	nfs_readdir_page_filler+0xd5/0x4e0 [nfs]
      	? nfs3_rpc_wrapper.constprop.9+0x42/0xc0 [nfsv3]
      	nfs_readdir_xdr_to_array+0x1fa/0x330 [nfs]
      	? mem_cgroup_commit_charge+0xac/0x160
      	? nfs_readdir_xdr_to_array+0x330/0x330 [nfs]
      	nfs_readdir_filler+0x22/0x90 [nfs]
      	do_read_cache_page+0x7e/0x1a0
      	read_cache_page+0x1c/0x20
      	nfs_readdir+0x18e/0x660 [nfs]
      	? nfs3_xdr_dec_getattr3res+0x80/0x80 [nfsv3]
      	iterate_dir+0x97/0x130
      	SyS_getdents+0x94/0x120
      	? fillonedir+0xd0/0xd0
      	system_call_fastpath+0x12/0x17
      Signed-off-by: NBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      ce85cfbe
  14. 16 4月, 2015 1 次提交
  15. 02 3月, 2015 2 次提交
  16. 20 11月, 2014 2 次提交
  17. 05 11月, 2014 1 次提交
  18. 09 10月, 2014 2 次提交
  19. 04 8月, 2014 8 次提交
    • N
      NFS: fix two problems in lookup_revalidate in RCU-walk · 50d77739
      NeilBrown 提交于
      1/ rcu_dereference isn't correct: that field isn't
         RCU protected.   It could potentially change at any time
         so ACCESS_ONCE might be justified.
      
         changes to ->d_parent are protected by ->d_seq.  However
         that isn't always checked after ->d_revalidate is called,
         so it is safest to keep the double-check that ->d_parent
         hasn't changed at the end of these functions.
      
      2/ in nfs4_lookup_revalidate, "->d_parent" was forgotten.
         So 'parent' was not the parent of 'dentry'.
         This fails safe is the context is that dentry->d_inode is
         NULL, and the result of parent->d_inode being NULL is
         that ECHILD is returned, which is always safe.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      50d77739
    • N
      NFS: allow lockless access to access_cache · f682a398
      NeilBrown 提交于
      The access cache is used during RCU-walk path lookups, so it is best
      to avoid locking if possible as taking a lock kills concurrency.
      
      The rbtree is not rcu-safe and cannot easily be made so.
      Instead we simply check the last (i.e. most recent) entry on the LRU
      list.  If this doesn't match, then we return -ECHILD and retry in
      lock/refcount mode.
      
      This requires freeing the nfs_access_entry struct with rcu, and
      requires using rcu access primatives when adding entries to the lru, and
      when examining the last entry.
      
      Calling put_rpccred before kfree_rcu looks a bit odd, but as
      put_rpccred already provides rcu protection, we know that the cred will
      not actually be freed until the next grace period, so any concurrent
      access will be safe.
      
      This patch provides about 5% performance improvement on a stat-heavy
      synthetic work load with 4 threads on a 2-core CPU.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      f682a398
    • N
      NFS: teach nfs_lookup_verify_inode to handle LOOKUP_RCU · 1fa1e384
      NeilBrown 提交于
      It fails with -ECHILD rather than make an RPC call.
      
      This allows nfs_lookup_revalidate to call it in RCU-walk mode.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      1fa1e384
    • N
      NFS: teach nfs_neg_need_reval to understand LOOKUP_RCU · 912a108d
      NeilBrown 提交于
      This requires nfs_check_verifier to take an rcu_walk flag, and requires
      an rcu version of nfs_revalidate_inode which returns -ECHILD rather
      than making an RPC call.
      
      With this, nfs_lookup_revalidate can call nfs_neg_need_reval in
      RCU-walk mode.
      
      We can also move the LOOKUP_RCU check past the nfs_check_verifier()
      call in nfs_lookup_revalidate.
      
      If RCU_WALK prevents nfs_check_verifier or nfs_neg_need_reval from
      doing a full check, they return a status indicating that a revalidation
      is required.  As this revalidation will not be possible in RCU_WALK
      mode, -ECHILD will ultimately be returned, which is the desired result.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      912a108d
    • N
      NFS: support RCU_WALK in nfs_permission() · f3324a2a
      NeilBrown 提交于
      nfs_permission makes two calls which are not always safe in RCU_WALK,
      rpc_lookup_cred and nfs_do_access.
      
      The second can easily be made rcu-safe by aborting with -ECHILD before
      making the RPC call.
      
      The former can be made rcu-safe by calling rpc_lookup_cred_nonblock()
      instead.
      As this will almost always succeed, we use it even when RCU_WALK
      isn't being used as it still saves some spinlocks in a common case.
      We only fall back to rpc_lookup_cred() if rpc_lookup_cred_nonblock()
      fails and MAY_NOT_BLOCK isn't set.
      
      This optimisation (always trying rpc_lookup_cred_nonblock()) is
      particularly important when a security module is active.
      In that case inode_permission() may return -ECHILD from
      security_inode_permission() even though ->permission() succeeded in
      RCU_WALK mode.
      This leads to may_lookup() retrying inode_permission after performing
      unlazy_walk().  The spinlock that rpc_lookup_cred() takes is often
      more expensive than anything security_inode_permission() does, so that
      spinlock becomes the main bottleneck.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      f3324a2a
    • N
      NFS: prepare for RCU-walk support but pushing tests later in code. · d51ac1a8
      NeilBrown 提交于
      nfs_lookup_revalidate, nfs4_lookup_revalidate, and nfs_permission
      all need to understand and handle RCU-walk for NFS to gain the
      benefits of RCU-walk for cached information.
      
      Currently these functions all immediately return -ECHILD
      if the relevant flag (LOOKUP_RCU or MAY_NOT_BLOCK) is set.
      
      This patch pushes those tests later in the code so that we only abort
      immediately before we enter rcu-unsafe code.  As subsequent patches
      make that rcu-unsafe code rcu-safe, several of these new tests will
      disappear.
      
      With this patch there are several paths through the code which will no
      longer return -ECHILD during an RCU-walk.  However these are mostly
      error paths or other uninteresting cases.
      
      A noteworthy change in nfs_lookup_revalidate is that we don't take
      (or put) the reference to ->d_parent when LOOKUP_RCU is set.
      Rather we rcu_dereference ->d_parent, and check that ->d_inode
      is not NULL.  We also check that ->d_parent hasn't changed after
      all the tests.
      
      In nfs4_lookup_revalidate we simply avoid testing LOOKUP_RCU on the
      path that only calls nfs_lookup_revalidate() as that function
      already performs the required test.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      d51ac1a8
    • N
      NFS: nfs4_lookup_revalidate: only evaluate parent if it will be used. · 49317a7f
      NeilBrown 提交于
      nfs4_lookup_revalidate only uses 'parent' to get 'dir', and only
      uses 'dir' if 'inode == NULL'.
      
      So we don't need to find out what 'parent' or 'dir' is until we
      know that 'inode' is NULL.
      
      By moving 'dget_parent' inside the 'if', we can reduce the number of
      call sites for 'dput(parent)'.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      49317a7f
    • T
      NFS: Enforce an upper limit on the number of cached access call · 3a505845
      Trond Myklebust 提交于
      This may be used to limit the number of cached credentials building up
      inside the access cache.
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      3a505845
  20. 18 4月, 2014 1 次提交
  21. 05 4月, 2014 1 次提交
  22. 18 3月, 2014 1 次提交
  23. 12 2月, 2014 1 次提交
  24. 11 2月, 2014 1 次提交
  25. 29 1月, 2014 1 次提交
  26. 28 1月, 2014 1 次提交
    • J
      NFS: fix the handling of NFS_INO_INVALID_DATA flag in nfs_revalidate_mapping · d529ef83
      Jeff Layton 提交于
      There is a possible race in how the nfs_invalidate_mapping function is
      handled.  Currently, we go and invalidate the pages in the file and then
      clear NFS_INO_INVALID_DATA.
      
      The problem is that it's possible for a stale page to creep into the
      mapping after the page was invalidated (i.e., via readahead). If another
      writer comes along and sets the flag after that happens but before
      invalidate_inode_pages2 returns then we could clear the flag
      without the cache having been properly invalidated.
      
      So, we must clear the flag first and then invalidate the pages. Doing
      this however, opens another race:
      
      It's possible to have two concurrent read() calls that end up in
      nfs_revalidate_mapping at the same time. The first one clears the
      NFS_INO_INVALID_DATA flag and then goes to call nfs_invalidate_mapping.
      
      Just before calling that though, the other task races in, checks the
      flag and finds it cleared. At that point, it trusts that the mapping is
      good and gets the lock on the page, allowing the read() to be satisfied
      from the cache even though the data is no longer valid.
      
      These effects are easily manifested by running diotest3 from the LTP
      test suite on NFS. That program does a series of DIO writes and buffered
      reads. The operations are serialized and page-aligned but the existing
      code fails the test since it occasionally allows a read to come out of
      the cache incorrectly. While mixing direct and buffered I/O isn't
      recommended, I believe it's possible to hit this in other ways that just
      use buffered I/O, though that situation is much harder to reproduce.
      
      The problem is that the checking/clearing of that flag and the
      invalidation of the mapping really need to be atomic. Fix this by
      serializing concurrent invalidations with a bitlock.
      
      At the same time, we also need to allow other places that check
      NFS_INO_INVALID_DATA to check whether we might be in the middle of
      invalidating the file, so fix up a couple of places that do that
      to look for the new NFS_INO_INVALIDATING flag.
      
      Doing this requires us to be careful not to set the bitlock
      unnecessarily, so this code only does that if it believes it will
      be doing an invalidation.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      d529ef83
  27. 06 1月, 2014 1 次提交
  28. 29 10月, 2013 1 次提交