aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.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/nfs4proc.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/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index aec4e47c462d..26dcd77abb07 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -207,12 +207,8 @@ static int nfs4_wait_clnt_recover(struct nfs_client *clp)
207 207
208 might_sleep(); 208 might_sleep();
209 209
210 rwsem_acquire(&clp->cl_sem.dep_map, 0, 0, _RET_IP_);
211
212 res = wait_on_bit(&clp->cl_state, NFS4CLNT_STATE_RECOVER, 210 res = wait_on_bit(&clp->cl_state, NFS4CLNT_STATE_RECOVER,
213 nfs4_wait_bit_killable, TASK_KILLABLE); 211 nfs4_wait_bit_killable, TASK_KILLABLE);
214
215 rwsem_release(&clp->cl_sem.dep_map, 1, _RET_IP_);
216 return res; 212 return res;
217} 213}
218 214
@@ -1135,7 +1131,6 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
1135 struct nfs4_state_owner *sp; 1131 struct nfs4_state_owner *sp;
1136 struct nfs4_state *state = NULL; 1132 struct nfs4_state *state = NULL;
1137 struct nfs_server *server = NFS_SERVER(dir); 1133 struct nfs_server *server = NFS_SERVER(dir);
1138 struct nfs_client *clp = server->nfs_client;
1139 struct nfs4_opendata *opendata; 1134 struct nfs4_opendata *opendata;
1140 int status; 1135 int status;
1141 1136
@@ -1150,11 +1145,10 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
1150 goto err_put_state_owner; 1145 goto err_put_state_owner;
1151 if (path->dentry->d_inode != NULL) 1146 if (path->dentry->d_inode != NULL)
1152 nfs4_return_incompatible_delegation(path->dentry->d_inode, flags & (FMODE_READ|FMODE_WRITE)); 1147 nfs4_return_incompatible_delegation(path->dentry->d_inode, flags & (FMODE_READ|FMODE_WRITE));
1153 down_read(&clp->cl_sem);
1154 status = -ENOMEM; 1148 status = -ENOMEM;
1155 opendata = nfs4_opendata_alloc(path, sp, flags, sattr); 1149 opendata = nfs4_opendata_alloc(path, sp, flags, sattr);
1156 if (opendata == NULL) 1150 if (opendata == NULL)
1157 goto err_release_rwsem; 1151 goto err_put_state_owner;
1158 1152
1159 if (path->dentry->d_inode != NULL) 1153 if (path->dentry->d_inode != NULL)
1160 opendata->state = nfs4_get_open_state(path->dentry->d_inode, sp); 1154 opendata->state = nfs4_get_open_state(path->dentry->d_inode, sp);
@@ -1172,13 +1166,10 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, int flags, struct
1172 goto err_opendata_put; 1166 goto err_opendata_put;
1173 nfs4_opendata_put(opendata); 1167 nfs4_opendata_put(opendata);
1174 nfs4_put_state_owner(sp); 1168 nfs4_put_state_owner(sp);
1175 up_read(&clp->cl_sem);
1176 *res = state; 1169 *res = state;
1177 return 0; 1170 return 0;
1178err_opendata_put: 1171err_opendata_put:
1179 nfs4_opendata_put(opendata); 1172 nfs4_opendata_put(opendata);
1180err_release_rwsem:
1181 up_read(&clp->cl_sem);
1182err_put_state_owner: 1173err_put_state_owner:
1183 nfs4_put_state_owner(sp); 1174 nfs4_put_state_owner(sp);
1184out_err: 1175out_err:
@@ -3099,7 +3090,6 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
3099 struct nfs4_lock_state *lsp; 3090 struct nfs4_lock_state *lsp;
3100 int status; 3091 int status;
3101 3092
3102 down_read(&clp->cl_sem);
3103 arg.lock_owner.clientid = clp->cl_clientid; 3093 arg.lock_owner.clientid = clp->cl_clientid;
3104 status = nfs4_set_lock_state(state, request); 3094 status = nfs4_set_lock_state(state, request);
3105 if (status != 0) 3095 if (status != 0)
@@ -3116,7 +3106,6 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
3116 } 3106 }
3117 request->fl_ops->fl_release_private(request); 3107 request->fl_ops->fl_release_private(request);
3118out: 3108out:
3119 up_read(&clp->cl_sem);
3120 return status; 3109 return status;
3121} 3110}
3122 3111
@@ -3273,7 +3262,6 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
3273 3262
3274static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) 3263static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request)
3275{ 3264{
3276 struct nfs_client *clp = state->owner->so_client;
3277 struct nfs_inode *nfsi = NFS_I(state->inode); 3265 struct nfs_inode *nfsi = NFS_I(state->inode);
3278 struct nfs_seqid *seqid; 3266 struct nfs_seqid *seqid;
3279 struct nfs4_lock_state *lsp; 3267 struct nfs4_lock_state *lsp;
@@ -3284,15 +3272,12 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
3284 status = nfs4_set_lock_state(state, request); 3272 status = nfs4_set_lock_state(state, request);
3285 /* Unlock _before_ we do the RPC call */ 3273 /* Unlock _before_ we do the RPC call */
3286 request->fl_flags |= FL_EXISTS; 3274 request->fl_flags |= FL_EXISTS;
3287 down_read(&clp->cl_sem);
3288 down_read(&nfsi->rwsem); 3275 down_read(&nfsi->rwsem);
3289 if (do_vfs_lock(request->fl_file, request) == -ENOENT) { 3276 if (do_vfs_lock(request->fl_file, request) == -ENOENT) {
3290 up_read(&nfsi->rwsem); 3277 up_read(&nfsi->rwsem);
3291 up_read(&clp->cl_sem);
3292 goto out; 3278 goto out;
3293 } 3279 }
3294 up_read(&nfsi->rwsem); 3280 up_read(&nfsi->rwsem);
3295 up_read(&clp->cl_sem);
3296 if (status != 0) 3281 if (status != 0)
3297 goto out; 3282 goto out;
3298 /* Is this a delegated lock? */ 3283 /* Is this a delegated lock? */
@@ -3518,7 +3503,6 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request
3518 3503
3519static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) 3504static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
3520{ 3505{
3521 struct nfs_client *clp = state->owner->so_client;
3522 struct nfs_inode *nfsi = NFS_I(state->inode); 3506 struct nfs_inode *nfsi = NFS_I(state->inode);
3523 unsigned char fl_flags = request->fl_flags; 3507 unsigned char fl_flags = request->fl_flags;
3524 int status; 3508 int status;
@@ -3531,7 +3515,6 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
3531 status = do_vfs_lock(request->fl_file, request); 3515 status = do_vfs_lock(request->fl_file, request);
3532 if (status < 0) 3516 if (status < 0)
3533 goto out; 3517 goto out;
3534 down_read(&clp->cl_sem);
3535 down_read(&nfsi->rwsem); 3518 down_read(&nfsi->rwsem);
3536 if (test_bit(NFS_DELEGATED_STATE, &state->flags)) { 3519 if (test_bit(NFS_DELEGATED_STATE, &state->flags)) {
3537 /* Yes: cache locks! */ 3520 /* Yes: cache locks! */
@@ -3549,7 +3532,6 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
3549 printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __func__); 3532 printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __func__);
3550out_unlock: 3533out_unlock:
3551 up_read(&nfsi->rwsem); 3534 up_read(&nfsi->rwsem);
3552 up_read(&clp->cl_sem);
3553out: 3535out:
3554 request->fl_flags = fl_flags; 3536 request->fl_flags = fl_flags;
3555 return status; 3537 return status;