diff options
Diffstat (limited to 'fs/lockd/clntproc.c')
-rw-r--r-- | fs/lockd/clntproc.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index c5a33648e9fd..816333cd377b 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 | */ |
@@ -399,8 +400,7 @@ in_grace_period: | |||
399 | /* | 400 | /* |
400 | * Generic NLM call, async version. | 401 | * Generic NLM call, async version. |
401 | */ | 402 | */ |
402 | int | 403 | 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 | { | 404 | { |
405 | struct nlm_host *host = req->a_host; | 405 | struct nlm_host *host = req->a_host; |
406 | struct rpc_clnt *clnt; | 406 | struct rpc_clnt *clnt; |
@@ -419,13 +419,12 @@ nlmsvc_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback) | |||
419 | msg.rpc_proc = &clnt->cl_procinfo[proc]; | 419 | msg.rpc_proc = &clnt->cl_procinfo[proc]; |
420 | 420 | ||
421 | /* bootstrap and kick off the async RPC call */ | 421 | /* bootstrap and kick off the async RPC call */ |
422 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, callback, req); | 422 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, tk_ops, req); |
423 | 423 | ||
424 | return status; | 424 | return status; |
425 | } | 425 | } |
426 | 426 | ||
427 | static int | 427 | 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 | { | 428 | { |
430 | struct nlm_host *host = req->a_host; | 429 | struct nlm_host *host = req->a_host; |
431 | struct rpc_clnt *clnt; | 430 | struct rpc_clnt *clnt; |
@@ -448,7 +447,7 @@ nlmclnt_async_call(struct nlm_rqst *req, u32 proc, rpc_action callback) | |||
448 | /* Increment host refcount */ | 447 | /* Increment host refcount */ |
449 | nlm_get_host(host); | 448 | nlm_get_host(host); |
450 | /* bootstrap and kick off the async RPC call */ | 449 | /* bootstrap and kick off the async RPC call */ |
451 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, callback, req); | 450 | status = rpc_call_async(clnt, &msg, RPC_TASK_ASYNC, tk_ops, req); |
452 | if (status < 0) | 451 | if (status < 0) |
453 | nlm_release_host(host); | 452 | nlm_release_host(host); |
454 | return status; | 453 | return status; |
@@ -664,7 +663,7 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
664 | 663 | ||
665 | if (req->a_flags & RPC_TASK_ASYNC) { | 664 | if (req->a_flags & RPC_TASK_ASYNC) { |
666 | status = nlmclnt_async_call(req, NLMPROC_UNLOCK, | 665 | status = nlmclnt_async_call(req, NLMPROC_UNLOCK, |
667 | nlmclnt_unlock_callback); | 666 | &nlmclnt_unlock_ops); |
668 | /* Hrmf... Do the unlock early since locks_remove_posix() | 667 | /* Hrmf... Do the unlock early since locks_remove_posix() |
669 | * really expects us to free the lock synchronously */ | 668 | * really expects us to free the lock synchronously */ |
670 | do_vfs_lock(fl); | 669 | do_vfs_lock(fl); |
@@ -692,10 +691,9 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
692 | return -ENOLCK; | 691 | return -ENOLCK; |
693 | } | 692 | } |
694 | 693 | ||
695 | static void | 694 | static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) |
696 | nlmclnt_unlock_callback(struct rpc_task *task) | ||
697 | { | 695 | { |
698 | struct nlm_rqst *req = (struct nlm_rqst *) task->tk_calldata; | 696 | struct nlm_rqst *req = data; |
699 | int status = req->a_res.status; | 697 | int status = req->a_res.status; |
700 | 698 | ||
701 | if (RPC_ASSASSINATED(task)) | 699 | if (RPC_ASSASSINATED(task)) |
@@ -722,6 +720,10 @@ die: | |||
722 | rpc_restart_call(task); | 720 | rpc_restart_call(task); |
723 | } | 721 | } |
724 | 722 | ||
723 | static const struct rpc_call_ops nlmclnt_unlock_ops = { | ||
724 | .rpc_call_done = nlmclnt_unlock_callback, | ||
725 | }; | ||
726 | |||
725 | /* | 727 | /* |
726 | * Cancel a blocked lock request. | 728 | * Cancel a blocked lock request. |
727 | * We always use an async RPC call for this in order not to hang a | 729 | * We always use an async RPC call for this in order not to hang a |
@@ -750,8 +752,7 @@ nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl) | |||
750 | 752 | ||
751 | nlmclnt_setlockargs(req, fl); | 753 | nlmclnt_setlockargs(req, fl); |
752 | 754 | ||
753 | status = nlmclnt_async_call(req, NLMPROC_CANCEL, | 755 | status = nlmclnt_async_call(req, NLMPROC_CANCEL, &nlmclnt_cancel_ops); |
754 | nlmclnt_cancel_callback); | ||
755 | if (status < 0) { | 756 | if (status < 0) { |
756 | nlmclnt_release_lockargs(req); | 757 | nlmclnt_release_lockargs(req); |
757 | kfree(req); | 758 | kfree(req); |
@@ -765,10 +766,9 @@ nlmclnt_cancel(struct nlm_host *host, struct file_lock *fl) | |||
765 | return status; | 766 | return status; |
766 | } | 767 | } |
767 | 768 | ||
768 | static void | 769 | static void nlmclnt_cancel_callback(struct rpc_task *task, void *data) |
769 | nlmclnt_cancel_callback(struct rpc_task *task) | ||
770 | { | 770 | { |
771 | struct nlm_rqst *req = (struct nlm_rqst *) task->tk_calldata; | 771 | struct nlm_rqst *req = data; |
772 | 772 | ||
773 | if (RPC_ASSASSINATED(task)) | 773 | if (RPC_ASSASSINATED(task)) |
774 | goto die; | 774 | goto die; |
@@ -807,6 +807,10 @@ retry_cancel: | |||
807 | rpc_delay(task, 30 * HZ); | 807 | rpc_delay(task, 30 * HZ); |
808 | } | 808 | } |
809 | 809 | ||
810 | static const struct rpc_call_ops nlmclnt_cancel_ops = { | ||
811 | .rpc_call_done = nlmclnt_cancel_callback, | ||
812 | }; | ||
813 | |||
810 | /* | 814 | /* |
811 | * Convert an NLM status code to a generic kernel errno | 815 | * Convert an NLM status code to a generic kernel errno |
812 | */ | 816 | */ |