aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-07-30 08:27:09 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-08-01 16:28:23 -0400
commit3e339f964b74b7223ab128f36f4b2aaf9dc12eb9 (patch)
tree27a2c6348382b1e28889e8d706e7edb3a161c979 /fs/nfsd/nfs4state.c
parent6b10ad193d391c295146f23cbe8523e48df78999 (diff)
nfsd: Ensure lookup_clientid() takes client_lock
Ensure that the client lookup is done safely under the client_lock, so we're not relying on the client_mutex. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 68383b09c7dc..f9d077d800ee 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3451,13 +3451,17 @@ static __be32 lookup_clientid(clientid_t *clid,
3451 * will be false. 3451 * will be false.
3452 */ 3452 */
3453 WARN_ON_ONCE(cstate->session); 3453 WARN_ON_ONCE(cstate->session);
3454 spin_lock(&nn->client_lock);
3454 found = find_confirmed_client(clid, false, nn); 3455 found = find_confirmed_client(clid, false, nn);
3455 if (!found) 3456 if (!found) {
3457 spin_unlock(&nn->client_lock);
3456 return nfserr_expired; 3458 return nfserr_expired;
3459 }
3460 atomic_inc(&found->cl_refcount);
3461 spin_unlock(&nn->client_lock);
3457 3462
3458 /* Cache the nfs4_client in cstate! */ 3463 /* Cache the nfs4_client in cstate! */
3459 cstate->clp = found; 3464 cstate->clp = found;
3460 atomic_inc(&found->cl_refcount);
3461 return nfs_ok; 3465 return nfs_ok;
3462} 3466}
3463 3467