summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-08-20 03:21:56 +0300
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-08-27 17:17:40 -0400
commitaaf84eb95a9c610c6413cee4836764ea9194eed3 (patch)
tree439d25aa70e6226ae8895db8a7503fd63a62a907
parenteac81736e6884484ebb45f8d0cba639f3285382b (diff)
downloadlinux-stable-aaf84eb95a9c610c6413cee4836764ea9194eed3.tar.gz
linux-stable-aaf84eb95a9c610c6413cee4836764ea9194eed3.tar.bz2
linux-stable-aaf84eb95a9c610c6413cee4836764ea9194eed3.zip
nfsd41: renew_client must be called under the state lock
Until we work out the state locking so we can use a spin lock to protect the cl_lru, we need to take the state_lock to renew the client. Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: Do not renew state on error] Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfsd41: Simplify exit code] Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/nfsd/nfs4state.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index d2a052480908..5f634d24861c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1481,7 +1481,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
* for nfsd4_svc_encode_compoundres processing */
status = nfsd4_replay_cache_entry(resp, seq);
cstate->status = nfserr_replay_cache;
- goto replay_cache;
+ goto out;
}
if (status)
goto out;
@@ -1497,15 +1497,18 @@ nfsd4_sequence(struct svc_rqst *rqstp,
cstate->slot = slot;
cstate->session = session;
-replay_cache:
- /* Renew the clientid on success and on replay.
- * Hold a session reference until done processing the compound:
+ /* Hold a session reference until done processing the compound:
* nfsd4_put_session called only if the cstate slot is set.
*/
- renew_client(session->se_client);
nfsd4_get_session(session);
out:
spin_unlock(&sessionid_lock);
+ /* Renew the clientid on success and on replay */
+ if (cstate->session) {
+ nfs4_lock_state();
+ renew_client(session->se_client);
+ nfs4_unlock_state();
+ }
dprintk("%s: return %d\n", __func__, ntohl(status));
return status;
}