aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 18:11:10 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 18:11:10 -0500
commit7a1218a277c45cba1fb8d7089407a1769c645c43 (patch)
treec59634979c53606696993ef06297045015791d6e /fs/nfs/nfs4proc.c
parent43ac3f2961b8616da26114ec6dc76ac2a61f76ad (diff)
SUNRPC: Ensure rpc_call_async() always calls tk_ops->rpc_release()
Currently this will not happen if we exit before rpc_new_task() was called. Also fix up rpc_run_task() to do the same (for consistency). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 02c7d8c04c58..4aba15ad1d27 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -605,11 +605,14 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
605 int status; 605 int status;
606 606
607 atomic_inc(&data->count); 607 atomic_inc(&data->count);
608 /*
609 * If rpc_run_task() ends up calling ->rpc_release(), we
610 * want to ensure that it takes the 'error' code path.
611 */
612 data->rpc_status = -ENOMEM;
608 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_confirm_ops, data); 613 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_confirm_ops, data);
609 if (IS_ERR(task)) { 614 if (IS_ERR(task))
610 nfs4_opendata_free(data);
611 return PTR_ERR(task); 615 return PTR_ERR(task);
612 }
613 status = nfs4_wait_for_completion_rpc_task(task); 616 status = nfs4_wait_for_completion_rpc_task(task);
614 if (status != 0) { 617 if (status != 0) {
615 data->cancelled = 1; 618 data->cancelled = 1;
@@ -708,11 +711,14 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
708 int status; 711 int status;
709 712
710 atomic_inc(&data->count); 713 atomic_inc(&data->count);
714 /*
715 * If rpc_run_task() ends up calling ->rpc_release(), we
716 * want to ensure that it takes the 'error' code path.
717 */
718 data->rpc_status = -ENOMEM;
711 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_ops, data); 719 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_ops, data);
712 if (IS_ERR(task)) { 720 if (IS_ERR(task))
713 nfs4_opendata_free(data);
714 return PTR_ERR(task); 721 return PTR_ERR(task);
715 }
716 status = nfs4_wait_for_completion_rpc_task(task); 722 status = nfs4_wait_for_completion_rpc_task(task);
717 if (status != 0) { 723 if (status != 0) {
718 data->cancelled = 1; 724 data->cancelled = 1;
@@ -2959,10 +2965,8 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
2959 data->rpc_status = 0; 2965 data->rpc_status = 0;
2960 2966
2961 task = rpc_run_task(NFS_CLIENT(inode), RPC_TASK_ASYNC, &nfs4_delegreturn_ops, data); 2967 task = rpc_run_task(NFS_CLIENT(inode), RPC_TASK_ASYNC, &nfs4_delegreturn_ops, data);
2962 if (IS_ERR(task)) { 2968 if (IS_ERR(task))
2963 nfs4_delegreturn_release(data);
2964 return PTR_ERR(task); 2969 return PTR_ERR(task);
2965 }
2966 status = nfs4_wait_for_completion_rpc_task(task); 2970 status = nfs4_wait_for_completion_rpc_task(task);
2967 if (status == 0) { 2971 if (status == 0) {
2968 status = data->rpc_status; 2972 status = data->rpc_status;
@@ -3182,7 +3186,6 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
3182 struct nfs_seqid *seqid) 3186 struct nfs_seqid *seqid)
3183{ 3187{
3184 struct nfs4_unlockdata *data; 3188 struct nfs4_unlockdata *data;
3185 struct rpc_task *task;
3186 3189
3187 data = nfs4_alloc_unlockdata(fl, ctx, lsp, seqid); 3190 data = nfs4_alloc_unlockdata(fl, ctx, lsp, seqid);
3188 if (data == NULL) { 3191 if (data == NULL) {
@@ -3192,10 +3195,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
3192 3195
3193 /* Unlock _before_ we do the RPC call */ 3196 /* Unlock _before_ we do the RPC call */
3194 do_vfs_lock(fl->fl_file, fl); 3197 do_vfs_lock(fl->fl_file, fl);
3195 task = rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data); 3198 return rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data);
3196 if (IS_ERR(task))
3197 nfs4_locku_release_calldata(data);
3198 return task;
3199} 3199}
3200 3200
3201static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) 3201static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request)
@@ -3376,10 +3376,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3376 data->arg.reclaim = 1; 3376 data->arg.reclaim = 1;
3377 task = rpc_run_task(NFS_CLIENT(state->inode), RPC_TASK_ASYNC, 3377 task = rpc_run_task(NFS_CLIENT(state->inode), RPC_TASK_ASYNC,
3378 &nfs4_lock_ops, data); 3378 &nfs4_lock_ops, data);
3379 if (IS_ERR(task)) { 3379 if (IS_ERR(task))
3380 nfs4_lock_release(data);
3381 return PTR_ERR(task); 3380 return PTR_ERR(task);
3382 }
3383 ret = nfs4_wait_for_completion_rpc_task(task); 3381 ret = nfs4_wait_for_completion_rpc_task(task);
3384 if (ret == 0) { 3382 if (ret == 0) {
3385 ret = data->rpc_status; 3383 ret = data->rpc_status;