aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svcproc.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/svcproc.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/svcproc.c')
-rw-r--r--fs/lockd/svcproc.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 4986fbe44540..956d1d71e2af 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -505,43 +505,36 @@ nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp)
505 struct nlm_host *host; 505 struct nlm_host *host;
506 struct nlm_rqst *call; 506 struct nlm_rqst *call;
507 507
508 if (!(call = nlmclnt_alloc_call())) 508 host = nlmsvc_lookup_host(rqstp);
509 if (host == NULL)
509 return rpc_system_err; 510 return rpc_system_err;
510 511
511 host = nlmsvc_lookup_host(rqstp); 512 call = nlm_alloc_call(host);
512 if (!host) { 513 if (call == NULL)
513 kfree(call);
514 return rpc_system_err; 514 return rpc_system_err;
515 }
516 515
517 call->a_flags = RPC_TASK_ASYNC; 516 call->a_flags = RPC_TASK_ASYNC;
518 call->a_host = host;
519 memcpy(&call->a_args, resp, sizeof(*resp)); 517 memcpy(&call->a_args, resp, sizeof(*resp));
520 518
521 if (nlmsvc_async_call(call, proc, &nlmsvc_callback_ops) < 0) 519 if (nlm_async_call(call, proc, &nlmsvc_callback_ops) < 0)
522 goto error; 520 return rpc_system_err;
523
524 return rpc_success; 521 return rpc_success;
525 error:
526 nlm_release_host(host);
527 kfree(call);
528 return rpc_system_err;
529} 522}
530 523
531static void nlmsvc_callback_exit(struct rpc_task *task, void *data) 524static void nlmsvc_callback_exit(struct rpc_task *task, void *data)
532{ 525{
533 struct nlm_rqst *call = data; 526 dprintk("lockd: %4d callback returned %d\n", task->tk_pid,
527 -task->tk_status);
528}
534 529
535 if (task->tk_status < 0) { 530static void nlmsvc_callback_release(void *data)
536 dprintk("lockd: %4d callback failed (errno = %d)\n", 531{
537 task->tk_pid, -task->tk_status); 532 nlm_release_call(data);
538 }
539 nlm_release_host(call->a_host);
540 kfree(call);
541} 533}
542 534
543static const struct rpc_call_ops nlmsvc_callback_ops = { 535static const struct rpc_call_ops nlmsvc_callback_ops = {
544 .rpc_call_done = nlmsvc_callback_exit, 536 .rpc_call_done = nlmsvc_callback_exit,
537 .rpc_release = nlmsvc_callback_release,
545}; 538};
546 539
547/* 540/*