diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-07-30 14:27:09 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-08-01 22:28:23 +0200 |
commit | 3e339f964b74b7223ab128f36f4b2aaf9dc12eb9 (patch) | |
tree | 27a2c6348382b1e28889e8d706e7edb3a161c979 /fs/nfsd | |
parent | nfsd: Protect nfsd4_destroy_clientid using client_lock (diff) | |
download | linux-3e339f964b74b7223ab128f36f4b2aaf9dc12eb9.tar.xz linux-3e339f964b74b7223ab128f36f4b2aaf9dc12eb9.zip |
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')
-rw-r--r-- | fs/nfsd/nfs4state.c | 8 |
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, * will be false. */ WARN_ON_ONCE(cstate->session); + spin_lock(&nn->client_lock); found = find_confirmed_client(clid, false, nn); - if (!found) + if (!found) { + spin_unlock(&nn->client_lock); return nfserr_expired; + } + atomic_inc(&found->cl_refcount); + spin_unlock(&nn->client_lock); /* Cache the nfs4_client in cstate! */ cstate->clp = found; - atomic_inc(&found->cl_refcount); return nfs_ok; } |