diff options
Diffstat (limited to 'fs/lockd/clntproc.c')
-rw-r--r-- | fs/lockd/clntproc.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index c5a33648e9fd..145524039577 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -26,11 +26,12 @@ | |||
26 | static int nlmclnt_test(struct nlm_rqst *, struct file_lock *); | 26 | static int nlmclnt_test(struct nlm_rqst *, struct file_lock *); |
27 | static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *); | 27 | static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *); |
28 | static int nlmclnt_unlock(struct nlm_rqst *, struct file_lock *); | 28 | static int nlmclnt_unlock(struct nlm_rqst *, struct file_lock *); |
29 | static void nlmclnt_unlock_callback(struct rpc_task *); | ||
30 | static void nlmclnt_cancel_callback(struct rpc_task *); | ||
31 | static int nlm_stat_to_errno(u32 stat); | 29 | static int nlm_stat_to_errno(u32 stat); |
32 | static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host); | 30 | static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host); |
33 | 31 | ||
32 | static const struct rpc_call_ops nlmclnt_unlock_ops; | ||
33 | static const struct rpc_call_ops nlmclnt_cancel_ops; | ||
34 | |||
34 | /* | 35 | /* |
35 | * Cookie counter for NLM requests | 36 | * Cookie counter for NLM requests |
36 | */ | 37 | */ |
@@ -221,8 +222,7 @@ nlmclnt_proc(struct inode *inode, int cmd, struct file_lock *fl) | |||
221 | goto done; | 222 | goto done; |
222 | } | 223 | } |
223 | clnt->cl_softrtry = nfssrv->client->cl_softrtry; | 224 | clnt->cl_softrtry = nfssrv->client->cl_softrtry; |
224 | clnt->cl_intr = nfssrv->client->cl_intr; | 225 | clnt->cl_intr = nfssrv->client->cl_intr; |
225 | clnt->cl_chatty = nfssrv->client->cl_chatty; | ||
226 | } | 226 | } |
227 | 227 | ||
228 | /* Keep the old signal mask */ | 228 | /* Keep the old signal mask */ |
@@ -399,8 +399,7 @@ in_grace_period: | |||
399 | /* | 399 | /* |
400 | * Generic NLM call, async version. | 400 | * Generic NLM call, async version. |
401 | */ | 401 | */ |
402 | int | 402 | int nlmsvc_async_call(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops) |
403 | nlmsvc_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback) | ||
404 | { | 403 | { |
405 | struct nlm_host *host = req->a_host; | 404 | struct nlm_host *host = req->a_host; |
406 | struct rpc_clnt *clnt; | 405 | struct rpc_clnt *clnt; |
@@ -419,13 +418,12 @@ nlmsvc_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback) | |||
419 | msg.rpc_proc = &clnt->cl_procinfo[proc]; | 418 | msg.rpc_proc = &clnt->cl_procinfo[proc]; |
420 | 419 | ||
421 | /* bootstrap and kick off the async RPC call */ | 420 | /* bootstrap and kick off the async RPC call */ |
422 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, callback, req); | 421 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, tk_ops, req); |
423 | 422 | ||
424 | return status; | 423 | return status; |
425 | } | 424 | } |
426 | 425 | ||
427 | static int | 426 | static int nlmclnt_async_call(struct nlm_rqst *req, u32 proc, const struct rpc_call_ops *tk_ops) |
428 | nlmclnt_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback) | ||
429 | { | 427 | { |
430 | struct nlm_host *host = req->a_host; | 428 | struct nlm_host *host = req->a_host; |
431 | struct rpc_clnt *clnt; | 429 | struct rpc_clnt *clnt; |
@@ -448,7 +446,7 @@ nlmclnt_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback) | |||
448 | /* Increment host refcount */ | 446 | /* Increment host refcount */ |
449 | nlm_get_host(host); | 447 | nlm_get_host(host); |
450 | /* bootstrap and kick off the async RPC call */ | 448 | /* bootstrap and kick off the async RPC call */ |
451 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, callback, req); | 449 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, tk_ops, req); |
452 | if (status < 0) | 450 | if (status < 0) |
453 | nlm_release_host(host); | 451 | nlm_release_host(host); |
454 | return status; | 452 | return status; |
@@ -664,7 +662,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
664 | 662 | ||
665 | if (req->a_flags & RPC_TASK_ASYNC) { | 663 | if (req->a_flags & RPC_TASK_ASYNC) { |
666 | status = nlmclnt_async_call(req, NLMPROC_UNLOCK, | 664 | status = nlmclnt_async_call(req, NLMPROC_UNLOCK, |
667 | nlmclnt_unlock_callback); | 665 | &nlmclnt_unlock_ops); |
668 | /* Hrmf... Do the unlock early since locks_remove_posix() | 666 | /* Hrmf... Do the unlock early since locks_remove_posix() |
669 | * really expects us to free the lock synchronously */ | 667 | * really expects us to free the lock synchronously */ |
670 | do_vfs_lock(fl); | 668 | do_vfs_lock(fl); |
@@ -692,10 +690,9 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
692 | return -ENOLCK; | 690 | return -ENOLCK; |
693 | } | 691 | } |
694 | 692 | ||
695 | static void | 693 | static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) |
696 | nlmclnt_unlock_callback(struct rpc_task *task) | ||
697 | { | 694 | { |
698 | struct nlm_rqst *req = (struct nlm_rqst *) task->tk_calldata; | 695 | struct nlm_rqst *req = data; |
699 | int status = req->a_res.status; | 696 | int status = req->a_res.status; |
700 | 697 | ||
701 | if (RPC_ASSASSINATED(task)) | 698 | if (RPC_ASSASSINATED(task)) |
@@ -722,6 +719,10 @@ die: | |||
722 | rpc_restart_call(task); | 719 | rpc_restart_call(task); |
723 | } | 720 | } |
724 | 721 | ||
722 | static const struct rpc_call_ops nlmclnt_unlock_ops = { | ||
723 | .rpc_call_done = nlmclnt_unlock_callback, | ||
724 | }; | ||
725 | |||
725 | /* | 726 | /* |
726 | * Cancel a blocked lock request. | 727 | * Cancel a blocked lock request. |
727 | * We always use an async RPC call for this in order not to hang a | 728 | * We always use an async RPC call for this in order not to hang a |
@@ -750,8 +751,7 @@ nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl) | |||
750 | 751 | ||
751 | nlmclnt_setlockargs(req, fl); | 752 | nlmclnt_setlockargs(req, fl); |
752 | 753 | ||
753 | status = nlmclnt_async_call(req, NLMPROC_CANCEL, | 754 | status = nlmclnt_async_call(req, NLMPROC_CANCEL, &nlmclnt_cancel_ops); |
754 | nlmclnt_cancel_callback); | ||
755 | if (status < 0) { | 755 | if (status < 0) { |
756 | nlmclnt_release_lockargs(req); | 756 | nlmclnt_release_lockargs(req); |
757 | kfree(req); | 757 | kfree(req); |
@@ -765,10 +765,9 @@ nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl) | |||
765 | return status; | 765 | return status; |
766 | } | 766 | } |
767 | 767 | ||
768 | static void | 768 | static void nlmclnt_cancel_callback(struct rpc_task *task, void *data) |
769 | nlmclnt_cancel_callback(struct rpc_task *task) | ||
770 | { | 769 | { |
771 | struct nlm_rqst *req = (struct nlm_rqst *) task->tk_calldata; | 770 | struct nlm_rqst *req = data; |
772 | 771 | ||
773 | if (RPC_ASSASSINATED(task)) | 772 | if (RPC_ASSASSINATED(task)) |
774 | goto die; | 773 | goto die; |
@@ -807,6 +806,10 @@ retry_cancel: | |||
807 | rpc_delay(task, 30 * HZ); | 806 | rpc_delay(task, 30 * HZ); |
808 | } | 807 | } |
809 | 808 | ||
809 | static const struct rpc_call_ops nlmclnt_cancel_ops = { | ||
810 | .rpc_call_done = nlmclnt_cancel_callback, | ||
811 | }; | ||
812 | |||
810 | /* | 813 | /* |
811 | * Convert an NLM status code to a generic kernel errno | 814 | * Convert an NLM status code to a generic kernel errno |
812 | */ | 815 | */ |