aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:45 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-12-23 15:21:45 -0500
commit95d35cb4c473c754824967c0b069bbeb7efa4847 (patch)
treebd46a5b0e4d35f9256cf44ca2706493fc3dd2819 /fs/nfs/nfs4state.c
parent19e03c570e6099ffaf24e5628d4fe1a8acbe820d (diff)
NFSv4: Remove nfs_client->cl_sem
Now that we're using the flags to indicate state that needs to be recovered, as well as having implemented proper refcounting and spinlocking on the state and open_owners, we can get rid of nfs_client->cl_sem. The only remaining case that was dubious was the file locking, and that case is now covered by the nfsi->rwsem. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 16c9fbdf97b4..ec0cbe00a804 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -305,10 +305,6 @@ nfs4_drop_state_owner(struct nfs4_state_owner *sp)
305 } 305 }
306} 306}
307 307
308/*
309 * Note: must be called with clp->cl_sem held in order to prevent races
310 * with reboot recovery!
311 */
312struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct rpc_cred *cred) 308struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct rpc_cred *cred)
313{ 309{
314 struct nfs_client *clp = server->nfs_client; 310 struct nfs_client *clp = server->nfs_client;
@@ -337,10 +333,6 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
337 return sp; 333 return sp;
338} 334}
339 335
340/*
341 * Must be called with clp->cl_sem held in order to avoid races
342 * with state recovery...
343 */
344void nfs4_put_state_owner(struct nfs4_state_owner *sp) 336void nfs4_put_state_owner(struct nfs4_state_owner *sp)
345{ 337{
346 struct nfs_client *clp = sp->so_client; 338 struct nfs_client *clp = sp->so_client;
@@ -442,10 +434,6 @@ out:
442 return state; 434 return state;
443} 435}
444 436
445/*
446 * Beware! Caller must be holding exactly one
447 * reference to clp->cl_sem!
448 */
449void nfs4_put_open_state(struct nfs4_state *state) 437void nfs4_put_open_state(struct nfs4_state *state)
450{ 438{
451 struct inode *inode = state->inode; 439 struct inode *inode = state->inode;
@@ -578,7 +566,6 @@ static void nfs4_free_lock_state(struct nfs4_lock_state *lsp)
578 * Return a compatible lock_state. If no initialized lock_state structure 566 * Return a compatible lock_state. If no initialized lock_state structure
579 * exists, return an uninitialized one. 567 * exists, return an uninitialized one.
580 * 568 *
581 * The caller must be holding clp->cl_sem
582 */ 569 */
583static struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t owner) 570static struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t owner)
584{ 571{
@@ -1127,7 +1114,6 @@ static int reclaimer(void *ptr)
1127 allow_signal(SIGKILL); 1114 allow_signal(SIGKILL);
1128 1115
1129 /* Ensure exclusive access to NFSv4 state */ 1116 /* Ensure exclusive access to NFSv4 state */
1130 down_write(&clp->cl_sem);
1131 while (!list_empty(&clp->cl_superblocks)) { 1117 while (!list_empty(&clp->cl_superblocks)) {
1132 if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { 1118 if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
1133 /* We're going to have to re-establish a clientid */ 1119 /* We're going to have to re-establish a clientid */
@@ -1149,7 +1135,6 @@ static int reclaimer(void *ptr)
1149 1135
1150 /* First recover reboot state... */ 1136 /* First recover reboot state... */
1151 if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { 1137 if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
1152 /* Note: list is protected by exclusive lock on cl->cl_sem */
1153 status = nfs4_do_reclaim(clp, &nfs4_reboot_recovery_ops); 1138 status = nfs4_do_reclaim(clp, &nfs4_reboot_recovery_ops);
1154 if (status == -NFS4ERR_STALE_CLIENTID) 1139 if (status == -NFS4ERR_STALE_CLIENTID)
1155 continue; 1140 continue;
@@ -1159,7 +1144,6 @@ static int reclaimer(void *ptr)
1159 1144
1160 /* Now recover expired state... */ 1145 /* Now recover expired state... */
1161 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) { 1146 if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) {
1162 /* Note: list is protected by exclusive lock on cl->cl_sem */
1163 status = nfs4_do_reclaim(clp, &nfs4_nograce_recovery_ops); 1147 status = nfs4_do_reclaim(clp, &nfs4_nograce_recovery_ops);
1164 if (status < 0) { 1148 if (status < 0) {
1165 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state); 1149 set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
@@ -1175,7 +1159,6 @@ static int reclaimer(void *ptr)
1175 break; 1159 break;
1176 } 1160 }
1177out: 1161out:
1178 up_write(&clp->cl_sem);
1179 if (test_and_clear_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state)) 1162 if (test_and_clear_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state))
1180 nfs_handle_cb_pathdown(clp); 1163 nfs_handle_cb_pathdown(clp);
1181 nfs4_clear_recover_bit(clp); 1164 nfs4_clear_recover_bit(clp);