nfsd4: nfsd4_destroy_session must set callback client under the state lock
authorBenny Halevy <bhalevy@panasas.com>
Tue, 11 May 2010 21:14:06 +0000 (00:14 +0300)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Thu, 13 May 2010 15:59:11 +0000 (11:59 -0400)
nfsd4_set_callback_client must be called under the state lock to atomically
set or unset the callback client and shutting down the previous one.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/nfsd/nfs4callback.c
fs/nfsd/nfs4state.c

index 1d5051d46b4685a6993f3d53ac1e43a98367a84b..77bc9d3c80fde989c166725b04247c06b8f26e48 100644 (file)
@@ -718,6 +718,7 @@ void nfsd4_destroy_callback_queue(void)
        destroy_workqueue(callback_wq);
 }
 
+/* must be called under the state lock */
 void nfsd4_set_callback_client(struct nfs4_client *clp, struct rpc_clnt *new)
 {
        struct rpc_clnt *old = clp->cl_cb_client;
index cc0e9117dd16398895fc545b95b70ee8764fa6ac..ede9dde52fe8ee6d156eec32ce4798d68f4485f4 100644 (file)
@@ -1427,8 +1427,10 @@ nfsd4_destroy_session(struct svc_rqst *r,
        unhash_session(ses);
        spin_unlock(&client_lock);
 
+       nfs4_lock_state();
        /* wait for callbacks */
        nfsd4_set_callback_client(ses->se_client, NULL);
+       nfs4_unlock_state();
        nfsd4_put_session(ses);
        status = nfs_ok;
 out: