aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:45 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:45 -0500
commit92737230dd3f1478033819d4bc20339f8da852da (patch)
tree27bc7804a077a29b7614c698bb02632dc4ce228e /fs/lockd/svc4proc.c
parente4cd038a45a46ffbe06a1a72f3f15246e5b041ca (diff)
NLM: Add nlmclnt_release_call
Add a helper function to simplify the freeing of NLM client requests. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd/svc4proc.c')
-rw-r--r--fs/lockd/svc4proc.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index ac4a700af01a..cb51c7025825 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -480,43 +480,37 @@ nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp)
480 struct nlm_host *host; 480 struct nlm_host *host;
481 struct nlm_rqst *call; 481 struct nlm_rqst *call;
482 482
483 if (!(call = nlmclnt_alloc_call())) 483 host = nlmsvc_lookup_host(rqstp);
484 if (host == NULL)
484 return rpc_system_err; 485 return rpc_system_err;
485 486
486 host = nlmsvc_lookup_host(rqstp); 487 call = nlm_alloc_call(host);
487 if (!host) { 488 if (call == NULL)
488 kfree(call);
489 return rpc_system_err; 489 return rpc_system_err;
490 } 490
491 491
492 call->a_flags = RPC_TASK_ASYNC; 492 call->a_flags = RPC_TASK_ASYNC;
493 call->a_host = host;
494 memcpy(&call->a_args, resp, sizeof(*resp)); 493 memcpy(&call->a_args, resp, sizeof(*resp));
495 494
496 if (nlmsvc_async_call(call, proc, &nlm4svc_callback_ops) < 0) 495 if (nlm_async_call(call, proc, &nlm4svc_callback_ops) < 0)
497 goto error; 496 return rpc_system_err;
498
499 return rpc_success; 497 return rpc_success;
500 error:
501 kfree(call);
502 nlm_release_host(host);
503 return rpc_system_err;
504} 498}
505 499
506static void nlm4svc_callback_exit(struct rpc_task *task, void *data) 500static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
507{ 501{
508 struct nlm_rqst *call = data; 502 dprintk("lockd: %4d callback returned %d\n", task->tk_pid,
503 -task->tk_status);
504}
509 505
510 if (task->tk_status < 0) { 506static void nlm4svc_callback_release(void *data)
511 dprintk("lockd: %4d callback failed (errno = %d)\n", 507{
512 task->tk_pid, -task->tk_status); 508 nlm_release_call(data);
513 }
514 nlm_release_host(call->a_host);
515 kfree(call);
516} 509}
517 510
518static const struct rpc_call_ops nlm4svc_callback_ops = { 511static const struct rpc_call_ops nlm4svc_callback_ops = {
519 .rpc_call_done = nlm4svc_callback_exit, 512 .rpc_call_done = nlm4svc_callback_exit,
513 .rpc_release = nlm4svc_callback_release,
520}; 514};
521 515
522/* 516/*