19 Oct, 2011

1 commit


26 Jul, 2011

1 commit


28 May, 2011

1 commit


29 Jan, 2011

1 commit

  • There is no reason to be freeing the delegation cred in the rcu callback,
    and doing so is resulting in a lockdep complaint that rpc_credcache_lock
    is being called from both softirq and non-softirq contexts.

    Reported-by: Chuck Lever
    Signed-off-by: Trond Myklebust
    Cc: stable@kernel.org

    Trond Myklebust
     

07 Jan, 2011

2 commits

  • Delegations are per-inode, not per-nfs_client. When a server file
    system is migrated, delegations on the client must be moved from the
    source to the destination nfs_server. Make it easier to manage a
    mount point's delegation list across a migration event by moving the
    list to the nfs_server struct.

    Clean up: I added documenting comments to public functions I changed
    in this patch. For consistency I added comments to all the other
    public functions in fs/nfs/delegation.c.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     
  • Clean up: Refactor code that takes clp->cl_lock and calls
    nfs_detach_delegations_locked() into its own function.

    While we're changing the call sites, get rid of the second parameter
    and the logic in nfs_detach_delegations_locked() that uses it, since
    callers always set that parameter of nfs_detach_delegations_locked()
    to NULL.

    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

18 Nov, 2010

1 commit


05 Oct, 2010

1 commit

  • 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: Arnd Bergmann
    Acked-by: Matthew Wilcox
    Cc: Christoph Hellwig
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: Andrew Morton
    Cc: Miklos Szeredi
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: John Kacur
    Cc: Sage Weil
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-fsdevel@vger.kernel.org

    Arnd Bergmann
     

04 Aug, 2010

1 commit


23 Jun, 2010

1 commit


15 May, 2010

1 commit

  • We do not want to have the state recovery thread kick off and wait for a
    memory reclaim, since that may deadlock when the writebacks end up
    waiting for the state recovery thread to complete.

    The safe thing is therefore to use GFP_NOFS in all open, close,
    delegation return, lock, etc. operations that may be called by the
    state recovery thread.

    Signed-off-by: Trond Myklebust

    Trond Myklebust
     

02 May, 2010

2 commits

  • 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: [] deactivate_super+0x60/0x80
    #1: (iprune_sem){+.+...}, at: [] invalidate_inodes+0x39/0x13a

    stack backtrace:
    Pid: 2281, comm: mount.nfs4 Not tainted 2.6.34-rc1-cachefs #110
    Call Trace:
    [] lockdep_rcu_dereference+0xaa/0xb2
    [] nfs_inode_return_delegation_noreclaim+0x5b/0xa0 [nfs]
    [] nfs4_clear_inode+0x11/0x1e [nfs]
    [] clear_inode+0x9e/0xf8
    [] dispose_list+0x67/0x10e
    [] invalidate_inodes+0x11c/0x13a
    [] generic_shutdown_super+0x42/0xf4
    [] kill_anon_super+0x11/0x4f
    [] nfs4_kill_super+0x3f/0x72 [nfs]
    [] deactivate_super+0x68/0x80
    [] mntput_no_expire+0xbb/0xf8
    [] release_mounts+0x9a/0xb0
    [] put_mnt_ns+0x6a/0x79
    [] nfs_follow_remote_path+0x5a/0x146 [nfs]
    [] ? nfs_do_root_mount+0x82/0x95 [nfs]
    [] nfs4_try_mount+0x75/0xaf [nfs]
    [] nfs4_get_sb+0x291/0x31a [nfs]
    [] vfs_kern_mount+0xb8/0x177
    [] do_kern_mount+0x48/0xe8
    [] do_mount+0x782/0x7f9
    [] sys_mount+0x83/0xbe
    [] system_call_fastpath+0x16/0x1b

    Also on:

    fs/nfs/delegation.c:215 invoked rcu_dereference_check() without protection!
    [] lockdep_rcu_dereference+0xaa/0xb2
    [] nfs_inode_set_delegation+0xfe/0x219 [nfs]
    [] nfs4_opendata_to_nfs4_state+0x2c2/0x30d [nfs]
    [] nfs4_do_open+0x2a6/0x3a6 [nfs]
    ...

    And:

    fs/nfs/delegation.c:40 invoked rcu_dereference_check() without protection!
    [] lockdep_rcu_dereference+0xaa/0xb2
    [] nfs_free_delegation+0x3d/0x6e [nfs]
    [] nfs_do_return_delegation+0x26/0x30 [nfs]
    [] __nfs_inode_return_delegation+0x1ef/0x1fe [nfs]
    [] nfs_client_return_marked_delegations+0xc9/0x124 [nfs]
    ...

    Signed-off-by: David Howells
    Signed-off-by: Paul E. McKenney
    Signed-off-by: Trond Myklebust

    David Howells
     
  • Ensure that we correctly rcu-dereference the delegation itself, and that we
    protect against removal while we're changing the contents.

    Signed-off-by: Trond Myklebust
    Signed-off-by: David Howells
    Signed-off-by: Paul E. McKenney

    Trond Myklebust
     

30 Mar, 2010

1 commit

  • …it 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: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

06 Dec, 2009

4 commits


03 Dec, 2009

1 commit

  • 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: Trond Myklebust

    Trond Myklebust
     

13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

18 Jun, 2009

2 commits


24 Dec, 2008

11 commits


17 May, 2008

1 commit


21 Feb, 2008

1 commit

  • 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: Harvey Harrison
    Signed-off-by: Trond Myklebust

    Harvey Harrison
     

30 Jan, 2008

3 commits


20 Oct, 2007

1 commit


12 Oct, 2007

1 commit