1. 18 11月, 2010 1 次提交
  2. 05 10月, 2010 1 次提交
    • A
      fs/locks.c: prepare for BKL removal · b89f4321
      Arnd Bergmann 提交于
      This prepares the removal of the big kernel lock from the
      file locking code. We still use the BKL as long as fs/lockd
      uses it and ceph might sleep, but we can flip the definition
      to a private spinlock as soon as that's done.
      All users outside of fs/lockd get converted to use
      lock_flocks() instead of lock_kernel() where appropriate.
      
      Based on an earlier patch to use a spinlock from Matthew
      Wilcox, who has attempted this a few times before, the
      earliest patch from over 10 years ago turned it into
      a semaphore, which ended up being slower than the BKL
      and was subsequently reverted.
      
      Someone should do some serious performance testing when
      this becomes a spinlock, since this has caused problems
      before. Using a spinlock should be at least as good
      as the BKL in theory, but who knows...
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NMatthew Wilcox <willy@linux.intel.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: "J. Bruce Fields" <bfields@fieldses.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Miklos Szeredi <mszeredi@suse.cz>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Sage Weil <sage@newdream.net>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-fsdevel@vger.kernel.org
      b89f4321
  3. 04 8月, 2010 1 次提交
  4. 23 6月, 2010 1 次提交
  5. 15 5月, 2010 1 次提交
  6. 02 5月, 2010 2 次提交
    • D
      NFS: Fix RCU issues in the NFSv4 delegation code · 17d2c0a0
      David Howells 提交于
      Fix a number of RCU issues in the NFSv4 delegation code.
      
       (1) delegation->cred doesn't need to be RCU protected as it's essentially an
           invariant refcounted structure.
      
           By the time we get to nfs_free_delegation(), the delegation is being
           released, so no one else should be attempting to use the saved
           credentials, and they can be cleared.
      
           However, since the list of delegations could still be under traversal at
           this point by such as nfs_client_return_marked_delegations(), the cred
           should be released in nfs_do_free_delegation() rather than in
           nfs_free_delegation().  Simply using rcu_assign_pointer() to clear it is
           insufficient as that doesn't stop the cred from being destroyed, and nor
           does calling put_rpccred() after call_rcu(), given that the latter is
           asynchronous.
      
       (2) nfs_detach_delegation_locked() and nfs_inode_set_delegation() should use
           rcu_derefence_protected() because they can only be called if
           nfs_client::cl_lock is held, and that guards against anyone changing
           nfsi->delegation under it.  Furthermore, the barrier imposed by
           rcu_dereference() is superfluous, given that the spin_lock() is also a
           barrier.
      
       (3) nfs_detach_delegation_locked() is now passed a pointer to the nfs_client
           struct so that it can issue lockdep advice based on clp->cl_lock for (2).
      
       (4) nfs_inode_return_delegation_noreclaim() and nfs_inode_return_delegation()
           should use rcu_access_pointer() outside the spinlocked region as they
           merely examine the pointer and don't follow it, thus rendering unnecessary
           the need to impose a partial ordering over the one item of interest.
      
           These result in an RCU warning like the following:
      
      [ INFO: suspicious rcu_dereference_check() usage. ]
      ---------------------------------------------------
      fs/nfs/delegation.c:332 invoked rcu_dereference_check() without protection!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 1, debug_locks = 0
      2 locks held by mount.nfs4/2281:
       #0:  (&type->s_umount_key#34){+.+...}, at: [<ffffffff810b25b4>] deactivate_super+0x60/0x80
       #1:  (iprune_sem){+.+...}, at: [<ffffffff810c332a>] invalidate_inodes+0x39/0x13a
      
      stack backtrace:
      Pid: 2281, comm: mount.nfs4 Not tainted 2.6.34-rc1-cachefs #110
      Call Trace:
       [<ffffffff8105149f>] lockdep_rcu_dereference+0xaa/0xb2
       [<ffffffffa00b4591>] nfs_inode_return_delegation_noreclaim+0x5b/0xa0 [nfs]
       [<ffffffffa0095d63>] nfs4_clear_inode+0x11/0x1e [nfs]
       [<ffffffff810c2d92>] clear_inode+0x9e/0xf8
       [<ffffffff810c3028>] dispose_list+0x67/0x10e
       [<ffffffff810c340d>] invalidate_inodes+0x11c/0x13a
       [<ffffffff810b1dc1>] generic_shutdown_super+0x42/0xf4
       [<ffffffff810b1ebe>] kill_anon_super+0x11/0x4f
       [<ffffffffa009893c>] nfs4_kill_super+0x3f/0x72 [nfs]
       [<ffffffff810b25bc>] deactivate_super+0x68/0x80
       [<ffffffff810c6744>] mntput_no_expire+0xbb/0xf8
       [<ffffffff810c681b>] release_mounts+0x9a/0xb0
       [<ffffffff810c689b>] put_mnt_ns+0x6a/0x79
       [<ffffffffa00983a1>] nfs_follow_remote_path+0x5a/0x146 [nfs]
       [<ffffffffa0098334>] ? nfs_do_root_mount+0x82/0x95 [nfs]
       [<ffffffffa00985a9>] nfs4_try_mount+0x75/0xaf [nfs]
       [<ffffffffa0098874>] nfs4_get_sb+0x291/0x31a [nfs]
       [<ffffffff810b2059>] vfs_kern_mount+0xb8/0x177
       [<ffffffff810b2176>] do_kern_mount+0x48/0xe8
       [<ffffffff810c810b>] do_mount+0x782/0x7f9
       [<ffffffff810c8205>] sys_mount+0x83/0xbe
       [<ffffffff81001eeb>] system_call_fastpath+0x16/0x1b
      
      Also on:
      
      fs/nfs/delegation.c:215 invoked rcu_dereference_check() without protection!
       [<ffffffff8105149f>] lockdep_rcu_dereference+0xaa/0xb2
       [<ffffffffa00b4223>] nfs_inode_set_delegation+0xfe/0x219 [nfs]
       [<ffffffffa00a9c6f>] nfs4_opendata_to_nfs4_state+0x2c2/0x30d [nfs]
       [<ffffffffa00aa15d>] nfs4_do_open+0x2a6/0x3a6 [nfs]
       ...
      
      And:
      
      fs/nfs/delegation.c:40 invoked rcu_dereference_check() without protection!
       [<ffffffff8105149f>] lockdep_rcu_dereference+0xaa/0xb2
       [<ffffffffa00b3bef>] nfs_free_delegation+0x3d/0x6e [nfs]
       [<ffffffffa00b3e71>] nfs_do_return_delegation+0x26/0x30 [nfs]
       [<ffffffffa00b406a>] __nfs_inode_return_delegation+0x1ef/0x1fe [nfs]
       [<ffffffffa00b448a>] nfs_client_return_marked_delegations+0xc9/0x124 [nfs]
       ...
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      17d2c0a0
    • T
      NFSv4: Fix the locking in nfs_inode_reclaim_delegation() · 8f649c37
      Trond Myklebust 提交于
      Ensure that we correctly rcu-dereference the delegation itself, and that we
      protect against removal while we're changing the contents.
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      8f649c37
  7. 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
  8. 06 12月, 2009 4 次提交
  9. 03 12月, 2009 1 次提交
    • T
      NFSv4: Fix a potential state manager deadlock when returning delegations · d18cc1fd
      Trond Myklebust 提交于
      The nfsv4 state manager could potentially deadlock inside
      __nfs_inode_return_delegation() if the server reboots, so that the calls to
      nfs_msync_inode() end up waiting on state recovery to complete.
      
      Also ensure that if a server reboot or network partition causes us to have
      to stop returning delegations, that NFS4CLNT_DELEGRETURN is set so that
      the state manager can resume any outstanding delegation returns after it
      has dealt with the state recovery situation.
      
      Finally, ensure that the state manager doesn't wait for the DELEGRETURN
      call to complete. It doesn't need to, and that too can cause a deadlock.
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      d18cc1fd
  10. 13 7月, 2009 1 次提交
  11. 18 6月, 2009 2 次提交
  12. 24 12月, 2008 11 次提交
  13. 17 5月, 2008 1 次提交
  14. 21 2月, 2008 1 次提交
    • H
      nfs: fix sparse warnings · 90dc7d27
      Harvey Harrison 提交于
      fs/nfs/nfs4state.c:788:34: warning: Using plain integer as NULL pointer
      fs/nfs/delegation.c:52:34: warning: Using plain integer as NULL pointer
      fs/nfs/idmap.c:312:12: warning: Using plain integer as NULL pointer
      fs/nfs/callback_xdr.c:257:6: warning: Using plain integer as NULL pointer
      fs/nfs/callback_xdr.c:270:6: warning: Using plain integer as NULL pointer
      fs/nfs/callback_xdr.c:281:6: warning: Using plain integer as NULL pointer
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      90dc7d27
  15. 30 1月, 2008 3 次提交
  16. 20 10月, 2007 1 次提交
  17. 12 10月, 2007 1 次提交
  18. 10 10月, 2007 1 次提交
  19. 08 8月, 2007 1 次提交
    • T
      NFSv4: Don't call put_rpccred() from an rcu callback · 905f8d16
      Trond Myklebust 提交于
      Doing so would require us to introduce bh-safe locks into put_rpccred().
      This patch fixes the lockdep complaint reported by Marc Dietrich:
      
      inconsistent {softirq-on-W} -> {in-softirq-W} usage.
      swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
       (rpc_credcache_lock){-+..}, at: [<c01dc487>]
      _atomic_dec_and_lock+0x17/0x60
      {softirq-on-W} state was registered at:
        [<c013e870>] __lock_acquire+0x650/0x1030
        [<c013f2b1>] lock_acquire+0x61/0x80
        [<c02db9ac>] _spin_lock+0x2c/0x40
        [<c01dc487>] _atomic_dec_and_lock+0x17/0x60
        [<dced55fd>] put_rpccred+0x5d/0x100 [sunrpc]
        [<dced56c1>] rpcauth_unbindcred+0x21/0x60 [sunrpc]
        [<dced3fd4>] a0 [sunrpc]
        [<dcecefe0>] rpc_call_sync+0x30/0x40 [sunrpc]
        [<dcedc73b>] rpcb_register+0xdb/0x180 [sunrpc]
        [<dced65b3>] svc_register+0x93/0x160 [sunrpc]
        [<dced6ebe>] __svc_create+0x1ee/0x220 [sunrpc]
        [<dced7053>] svc_create+0x13/0x20 [sunrpc]
        [<dcf6d722>] nfs_callback_up+0x82/0x120 [nfs]
        [<dcf48f36>] nfs_get_client+0x176/0x390 [nfs]
        [<dcf49181>] nfs4_set_client+0x31/0x190 [nfs]
        [<dcf49983>] nfs4_create_server+0x63/0x3b0 [nfs]
        [<dcf52426>] nfs4_get_sb+0x346/0x5b0 [nfs]
        [<c017b444>] vfs_kern_mount+0x94/0x110
        [<c0190a62>] do_mount+0x1f2/0x7d0
        [<c01910a6>] sys_mount+0x66/0xa0
        [<c0104046>] syscall_call+0x7/0xb
        [<ffffffff>] 0xffffffff
      irq event stamp: 5277830
      hardirqs last  enabled at (5277830): [<c017530a>] kmem_cache_free+0x8a/0xc0
      hardirqs last disabled at (5277829): [<c01752d2>] kmem_cache_free+0x52/0xc0
      softirqs last  enabled at (5277798): [<c0124173>] __do_softirq+0xa3/0xc0
      softirqs last disabled at (5277817): [<c01241d7>] do_softirq+0x47/0x50
      
      other info that might help us debug this:
      no locks held by swapper/0.
      
      stack backtrace:
       [<c0104fda>] show_trace_log_lvl+0x1a/0x30
       [<c0105c02>] show_trace+0x12/0x20
       [<c0105d15>] dump_stack+0x15/0x20
       [<c013ccc3>] print_usage_bug+0x153/0x160
       [<c013d8b9>] mark_lock+0x449/0x620
       [<c013e824>] __lock_acquire+0x604/0x1030
       [<c013f2b1>] lock_acquire+0x61/0x80
       [<c02db9ac>] _spin_lock+0x2c/0x40
       [<c01dc487>] _atomic_dec_and_lock+0x17/0x60
       [<dced55fd>] put_rpccred+0x5d/0x100 [sunrpc]
       [<dcf6bf83>] nfs_free_delegation_callback+0x13/0x20 [nfs]
       [<c012f9ea>] __rcu_process_callbacks+0x6a/0x1c0
       [<c012fb52>] rcu_process_callbacks+0x12/0x30
       [<c0124218>] tasklet_action+0x38/0x80
       [<c0124125>] __do_softirq+0x55/0xc0
       [<c01241d7>] do_softirq+0x47/0x50
       [<c0124605>] irq_exit+0x35/0x40
       [<c0112463>] smp_apic_timer_interrupt+0x43/0x80
       [<c0104a77>] apic_timer_interrupt+0x33/0x38
       [<c02690df>] cpuidle_idle_call+0x6f/0x90
       [<c01023c3>] cpu_idle+0x43/0x70
       [<c02d8c27>] rest_init+0x47/0x50
       [<c03bcb6a>] start_kernel+0x22a/0x2b0
       [<00000000>] 0x0
       =======================
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      905f8d16
  20. 11 7月, 2007 4 次提交