]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSv4: Don't call put_rpccred() under the rcu_read_lock()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 26 Feb 2015 17:54:46 +0000 (12:54 -0500)
committerZefan Li <lizefan@huawei.com>
Fri, 19 Jun 2015 03:40:20 +0000 (11:40 +0800)
commit 7c0af9ffb7bb4e5355470fa60b3eb711ddf226fa upstream.

put_rpccred() can sleep.

Fixes: 8f649c3762547 ("NFSv4: Fix the locking in nfs_inode_reclaim_delegation()")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
fs/nfs/delegation.c

index 16d16e56cc392805d6f5b26b16d3bc015498a986..62261deb0569e134d26974f0929a90fac21112f0 100644 (file)
@@ -148,8 +148,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
                                  &delegation->flags);
                        NFS_I(inode)->delegation_state = delegation->type;
                        spin_unlock(&delegation->lock);
-                       put_rpccred(oldcred);
                        rcu_read_unlock();
+                       put_rpccred(oldcred);
                } else {
                        /* We appear to have raced with a delegation return. */
                        spin_unlock(&delegation->lock);