Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23950
b: refs/heads/master
c: 7a1218a
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 20, 2006
1 parent 7531233 commit b7612fa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 43ac3f2961b8616da26114ec6dc76ac2a61f76ad
refs/heads/master: 7a1218a277c45cba1fb8d7089407a1769c645c43
32 changes: 15 additions & 17 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,14 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
int status;

atomic_inc(&data->count);
/*
* If rpc_run_task() ends up calling ->rpc_release(), we
* want to ensure that it takes the 'error' code path.
*/
data->rpc_status = -ENOMEM;
task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_confirm_ops, data);
if (IS_ERR(task)) {
nfs4_opendata_free(data);
if (IS_ERR(task))
return PTR_ERR(task);
}
status = nfs4_wait_for_completion_rpc_task(task);
if (status != 0) {
data->cancelled = 1;
Expand Down Expand Up @@ -708,11 +711,14 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
int status;

atomic_inc(&data->count);
/*
* If rpc_run_task() ends up calling ->rpc_release(), we
* want to ensure that it takes the 'error' code path.
*/
data->rpc_status = -ENOMEM;
task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_ops, data);
if (IS_ERR(task)) {
nfs4_opendata_free(data);
if (IS_ERR(task))
return PTR_ERR(task);
}
status = nfs4_wait_for_completion_rpc_task(task);
if (status != 0) {
data->cancelled = 1;
Expand Down Expand Up @@ -2959,10 +2965,8 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
data->rpc_status = 0;

task = rpc_run_task(NFS_CLIENT(inode), RPC_TASK_ASYNC, &nfs4_delegreturn_ops, data);
if (IS_ERR(task)) {
nfs4_delegreturn_release(data);
if (IS_ERR(task))
return PTR_ERR(task);
}
status = nfs4_wait_for_completion_rpc_task(task);
if (status == 0) {
status = data->rpc_status;
Expand Down Expand Up @@ -3182,7 +3186,6 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
struct nfs_seqid *seqid)
{
struct nfs4_unlockdata *data;
struct rpc_task *task;

data = nfs4_alloc_unlockdata(fl, ctx, lsp, seqid);
if (data == NULL) {
Expand All @@ -3192,10 +3195,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,

/* Unlock _before_ we do the RPC call */
do_vfs_lock(fl->fl_file, fl);
task = rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data);
if (IS_ERR(task))
nfs4_locku_release_calldata(data);
return task;
return rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data);
}

static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request)
Expand Down Expand Up @@ -3376,10 +3376,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
data->arg.reclaim = 1;
task = rpc_run_task(NFS_CLIENT(state->inode), RPC_TASK_ASYNC,
&nfs4_lock_ops, data);
if (IS_ERR(task)) {
nfs4_lock_release(data);
if (IS_ERR(task))
return PTR_ERR(task);
}
ret = nfs4_wait_for_completion_rpc_task(task);
if (ret == 0) {
ret = data->rpc_status;
Expand Down
10 changes: 7 additions & 3 deletions trunk/net/sunrpc/clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,16 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
int status;

/* If this client is slain all further I/O fails */
status = -EIO;
if (clnt->cl_dead)
return -EIO;
goto out_release;

flags |= RPC_TASK_ASYNC;

/* Create/initialize a new RPC task */
status = -ENOMEM;
if (!(task = rpc_new_task(clnt, flags, tk_ops, data)))
goto out;
goto out_release;

/* Mask signals on GSS_AUTH upcalls */
rpc_task_sigmask(task, &oldset);
Expand All @@ -518,7 +519,10 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
rpc_release_task(task);

rpc_restore_sigmask(&oldset);
out:
return status;
out_release:
if (tk_ops->rpc_release != NULL)
tk_ops->rpc_release(data);
return status;
}

Expand Down
5 changes: 4 additions & 1 deletion trunk/net/sunrpc/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,11 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
{
struct rpc_task *task;
task = rpc_new_task(clnt, flags, ops, data);
if (task == NULL)
if (task == NULL) {
if (ops->rpc_release != NULL)
ops->rpc_release(data);
return ERR_PTR(-ENOMEM);
}
atomic_inc(&task->tk_count);
rpc_execute(task);
return task;
Expand Down

0 comments on commit b7612fa

Please sign in to comment.