diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 18:11:10 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 18:11:10 -0500 |
commit | 7a1218a277c45cba1fb8d7089407a1769c645c43 (patch) | |
tree | c59634979c53606696993ef06297045015791d6e /net | |
parent | 43ac3f2961b8616da26114ec6dc76ac2a61f76ad (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 'net')
-rw-r--r-- | net/sunrpc/clnt.c | 10 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 6e71d6ace5a3..aa8965e9d307 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -495,15 +495,16 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, | |||
495 | int status; | 495 | int status; |
496 | 496 | ||
497 | /* If this client is slain all further I/O fails */ | 497 | /* If this client is slain all further I/O fails */ |
498 | status = -EIO; | ||
498 | if (clnt->cl_dead) | 499 | if (clnt->cl_dead) |
499 | return -EIO; | 500 | goto out_release; |
500 | 501 | ||
501 | flags |= RPC_TASK_ASYNC; | 502 | flags |= RPC_TASK_ASYNC; |
502 | 503 | ||
503 | /* Create/initialize a new RPC task */ | 504 | /* Create/initialize a new RPC task */ |
504 | status = -ENOMEM; | 505 | status = -ENOMEM; |
505 | if (!(task = rpc_new_task(clnt, flags, tk_ops, data))) | 506 | if (!(task = rpc_new_task(clnt, flags, tk_ops, data))) |
506 | goto out; | 507 | goto out_release; |
507 | 508 | ||
508 | /* Mask signals on GSS_AUTH upcalls */ | 509 | /* Mask signals on GSS_AUTH upcalls */ |
509 | rpc_task_sigmask(task, &oldset); | 510 | rpc_task_sigmask(task, &oldset); |
@@ -518,7 +519,10 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags, | |||
518 | rpc_release_task(task); | 519 | rpc_release_task(task); |
519 | 520 | ||
520 | rpc_restore_sigmask(&oldset); | 521 | rpc_restore_sigmask(&oldset); |
521 | out: | 522 | return status; |
523 | out_release: | ||
524 | if (tk_ops->rpc_release != NULL) | ||
525 | tk_ops->rpc_release(data); | ||
522 | return status; | 526 | return status; |
523 | } | 527 | } |
524 | 528 | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index cd51b5468332..3fc13bea302d 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -921,8 +921,11 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, | |||
921 | { | 921 | { |
922 | struct rpc_task *task; | 922 | struct rpc_task *task; |
923 | task = rpc_new_task(clnt, flags, ops, data); | 923 | task = rpc_new_task(clnt, flags, ops, data); |
924 | if (task == NULL) | 924 | if (task == NULL) { |
925 | if (ops->rpc_release != NULL) | ||
926 | ops->rpc_release(data); | ||
925 | return ERR_PTR(-ENOMEM); | 927 | return ERR_PTR(-ENOMEM); |
928 | } | ||
926 | atomic_inc(&task->tk_count); | 929 | atomic_inc(&task->tk_count); |
927 | rpc_execute(task); | 930 | rpc_execute(task); |
928 | return task; | 931 | return task; |