diff options
Diffstat (limited to 'fs/lockd')
| -rw-r--r-- | fs/lockd/clntproc.c | 41 | ||||
| -rw-r--r-- | fs/lockd/host.c | 4 | ||||
| -rw-r--r-- | fs/lockd/mon.c | 1 | ||||
| -rw-r--r-- | fs/lockd/svc.c | 4 | ||||
| -rw-r--r-- | fs/lockd/svc4proc.c | 15 | ||||
| -rw-r--r-- | fs/lockd/svclock.c | 42 | ||||
| -rw-r--r-- | fs/lockd/svcproc.c | 14 | ||||
| -rw-r--r-- | fs/lockd/xdr.c | 6 | ||||
| -rw-r--r-- | fs/lockd/xdr4.c | 4 |
9 files changed, 72 insertions, 59 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 | */ |
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index c4c8601096e0..82f7a0b1d8ae 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -177,7 +177,7 @@ nlm_bind_host(struct nlm_host *host) | |||
| 177 | if ((clnt = host->h_rpcclnt) != NULL) { | 177 | if ((clnt = host->h_rpcclnt) != NULL) { |
| 178 | xprt = clnt->cl_xprt; | 178 | xprt = clnt->cl_xprt; |
| 179 | if (time_after_eq(jiffies, host->h_nextrebind)) { | 179 | if (time_after_eq(jiffies, host->h_nextrebind)) { |
| 180 | clnt->cl_port = 0; | 180 | rpc_force_rebind(clnt); |
| 181 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; | 181 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
| 182 | dprintk("lockd: next rebind in %ld jiffies\n", | 182 | dprintk("lockd: next rebind in %ld jiffies\n", |
| 183 | host->h_nextrebind - jiffies); | 183 | host->h_nextrebind - jiffies); |
| @@ -217,7 +217,7 @@ nlm_rebind_host(struct nlm_host *host) | |||
| 217 | { | 217 | { |
| 218 | dprintk("lockd: rebind host %s\n", host->h_name); | 218 | dprintk("lockd: rebind host %s\n", host->h_name); |
| 219 | if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) { | 219 | if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) { |
| 220 | host->h_rpcclnt->cl_port = 0; | 220 | rpc_force_rebind(host->h_rpcclnt); |
| 221 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; | 221 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
| 222 | } | 222 | } |
| 223 | } | 223 | } |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 2d144abe84ad..0edc03e67966 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
| @@ -123,7 +123,6 @@ nsm_create(void) | |||
| 123 | if (IS_ERR(clnt)) | 123 | if (IS_ERR(clnt)) |
| 124 | goto out_err; | 124 | goto out_err; |
| 125 | clnt->cl_softrtry = 1; | 125 | clnt->cl_softrtry = 1; |
| 126 | clnt->cl_chatty = 1; | ||
| 127 | clnt->cl_oneshot = 1; | 126 | clnt->cl_oneshot = 1; |
| 128 | return clnt; | 127 | return clnt; |
| 129 | 128 | ||
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 12a857c29e25..71a30b416d1a 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
| @@ -178,6 +178,8 @@ lockd(struct svc_rqst *rqstp) | |||
| 178 | 178 | ||
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | flush_signals(current); | ||
| 182 | |||
| 181 | /* | 183 | /* |
| 182 | * Check whether there's a new lockd process before | 184 | * Check whether there's a new lockd process before |
| 183 | * shutting down the hosts and clearing the slot. | 185 | * shutting down the hosts and clearing the slot. |
| @@ -192,8 +194,6 @@ lockd(struct svc_rqst *rqstp) | |||
| 192 | "lockd: new process, skipping host shutdown\n"); | 194 | "lockd: new process, skipping host shutdown\n"); |
| 193 | wake_up(&lockd_exit); | 195 | wake_up(&lockd_exit); |
| 194 | 196 | ||
| 195 | flush_signals(current); | ||
| 196 | |||
| 197 | /* Exit the RPC thread */ | 197 | /* Exit the RPC thread */ |
| 198 | svc_exit_thread(rqstp); | 198 | svc_exit_thread(rqstp); |
| 199 | 199 | ||
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 489670e21769..4063095d849e 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
| @@ -22,7 +22,8 @@ | |||
| 22 | #define NLMDBG_FACILITY NLMDBG_CLIENT | 22 | #define NLMDBG_FACILITY NLMDBG_CLIENT |
| 23 | 23 | ||
| 24 | static u32 nlm4svc_callback(struct svc_rqst *, u32, struct nlm_res *); | 24 | static u32 nlm4svc_callback(struct svc_rqst *, u32, struct nlm_res *); |
| 25 | static void nlm4svc_callback_exit(struct rpc_task *); | 25 | |
| 26 | static const struct rpc_call_ops nlm4svc_callback_ops; | ||
| 26 | 27 | ||
| 27 | /* | 28 | /* |
| 28 | * Obtain client and file from arguments | 29 | * Obtain client and file from arguments |
| @@ -470,7 +471,6 @@ nlm4svc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp, | |||
| 470 | } | 471 | } |
| 471 | 472 | ||
| 472 | 473 | ||
| 473 | |||
| 474 | /* | 474 | /* |
| 475 | * This is the generic lockd callback for async RPC calls | 475 | * This is the generic lockd callback for async RPC calls |
| 476 | */ | 476 | */ |
| @@ -494,7 +494,7 @@ nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp) | |||
| 494 | call->a_host = host; | 494 | call->a_host = host; |
| 495 | memcpy(&call->a_args, resp, sizeof(*resp)); | 495 | memcpy(&call->a_args, resp, sizeof(*resp)); |
| 496 | 496 | ||
| 497 | if (nlmsvc_async_call(call, proc, nlm4svc_callback_exit) < 0) | 497 | if (nlmsvc_async_call(call, proc, &nlm4svc_callback_ops) < 0) |
| 498 | goto error; | 498 | goto error; |
| 499 | 499 | ||
| 500 | return rpc_success; | 500 | return rpc_success; |
| @@ -504,10 +504,9 @@ nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp) | |||
| 504 | return rpc_system_err; | 504 | return rpc_system_err; |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | static void | 507 | static void nlm4svc_callback_exit(struct rpc_task *task, void *data) |
| 508 | nlm4svc_callback_exit(struct rpc_task *task) | ||
| 509 | { | 508 | { |
| 510 | struct nlm_rqst *call = (struct nlm_rqst *) task->tk_calldata; | 509 | struct nlm_rqst *call = data; |
| 511 | 510 | ||
| 512 | if (task->tk_status < 0) { | 511 | if (task->tk_status < 0) { |
| 513 | dprintk("lockd: %4d callback failed (errno = %d)\n", | 512 | dprintk("lockd: %4d callback failed (errno = %d)\n", |
| @@ -517,6 +516,10 @@ nlm4svc_callback_exit(struct rpc_task *task) | |||
| 517 | kfree(call); | 516 | kfree(call); |
| 518 | } | 517 | } |
| 519 | 518 | ||
| 519 | static const struct rpc_call_ops nlm4svc_callback_ops = { | ||
| 520 | .rpc_call_done = nlm4svc_callback_exit, | ||
| 521 | }; | ||
| 522 | |||
| 520 | /* | 523 | /* |
| 521 | * NLM Server procedures. | 524 | * NLM Server procedures. |
| 522 | */ | 525 | */ |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 49f959796b66..9cfced65d4a2 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
| @@ -41,7 +41,8 @@ | |||
| 41 | 41 | ||
| 42 | static void nlmsvc_insert_block(struct nlm_block *block, unsigned long); | 42 | static void nlmsvc_insert_block(struct nlm_block *block, unsigned long); |
| 43 | static int nlmsvc_remove_block(struct nlm_block *block); | 43 | static int nlmsvc_remove_block(struct nlm_block *block); |
| 44 | static void nlmsvc_grant_callback(struct rpc_task *task); | 44 | |
| 45 | static const struct rpc_call_ops nlmsvc_grant_ops; | ||
| 45 | 46 | ||
| 46 | /* | 47 | /* |
| 47 | * The list of blocked locks to retry | 48 | * The list of blocked locks to retry |
| @@ -226,31 +227,27 @@ failed: | |||
| 226 | * It is the caller's responsibility to check whether the file | 227 | * It is the caller's responsibility to check whether the file |
| 227 | * can be closed hereafter. | 228 | * can be closed hereafter. |
| 228 | */ | 229 | */ |
| 229 | static void | 230 | static int |
| 230 | nlmsvc_delete_block(struct nlm_block *block, int unlock) | 231 | nlmsvc_delete_block(struct nlm_block *block, int unlock) |
| 231 | { | 232 | { |
| 232 | struct file_lock *fl = &block->b_call.a_args.lock.fl; | 233 | struct file_lock *fl = &block->b_call.a_args.lock.fl; |
| 233 | struct nlm_file *file = block->b_file; | 234 | struct nlm_file *file = block->b_file; |
| 234 | struct nlm_block **bp; | 235 | struct nlm_block **bp; |
| 236 | int status = 0; | ||
| 235 | 237 | ||
| 236 | dprintk("lockd: deleting block %p...\n", block); | 238 | dprintk("lockd: deleting block %p...\n", block); |
| 237 | 239 | ||
| 238 | /* Remove block from list */ | 240 | /* Remove block from list */ |
| 239 | nlmsvc_remove_block(block); | 241 | nlmsvc_remove_block(block); |
| 240 | if (fl->fl_next) | 242 | if (unlock) |
| 241 | posix_unblock_lock(file->f_file, fl); | 243 | status = posix_unblock_lock(file->f_file, fl); |
| 242 | if (unlock) { | ||
| 243 | fl->fl_type = F_UNLCK; | ||
| 244 | posix_lock_file(file->f_file, fl); | ||
| 245 | block->b_granted = 0; | ||
| 246 | } | ||
| 247 | 244 | ||
| 248 | /* If the block is in the middle of a GRANT callback, | 245 | /* If the block is in the middle of a GRANT callback, |
| 249 | * don't kill it yet. */ | 246 | * don't kill it yet. */ |
| 250 | if (block->b_incall) { | 247 | if (block->b_incall) { |
| 251 | nlmsvc_insert_block(block, NLM_NEVER); | 248 | nlmsvc_insert_block(block, NLM_NEVER); |
| 252 | block->b_done = 1; | 249 | block->b_done = 1; |
| 253 | return; | 250 | return status; |
| 254 | } | 251 | } |
| 255 | 252 | ||
| 256 | /* Remove block from file's list of blocks */ | 253 | /* Remove block from file's list of blocks */ |
| @@ -265,6 +262,7 @@ nlmsvc_delete_block(struct nlm_block *block, int unlock) | |||
| 265 | nlm_release_host(block->b_host); | 262 | nlm_release_host(block->b_host); |
| 266 | nlmclnt_freegrantargs(&block->b_call); | 263 | nlmclnt_freegrantargs(&block->b_call); |
| 267 | kfree(block); | 264 | kfree(block); |
| 265 | return status; | ||
| 268 | } | 266 | } |
| 269 | 267 | ||
| 270 | /* | 268 | /* |
| @@ -275,6 +273,7 @@ int | |||
| 275 | nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, int action) | 273 | nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, int action) |
| 276 | { | 274 | { |
| 277 | struct nlm_block *block, *next; | 275 | struct nlm_block *block, *next; |
| 276 | /* XXX: Will everything get cleaned up if we don't unlock here? */ | ||
| 278 | 277 | ||
| 279 | down(&file->f_sema); | 278 | down(&file->f_sema); |
| 280 | for (block = file->f_blocks; block; block = next) { | 279 | for (block = file->f_blocks; block; block = next) { |
| @@ -444,6 +443,7 @@ u32 | |||
| 444 | nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock) | 443 | nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock) |
| 445 | { | 444 | { |
| 446 | struct nlm_block *block; | 445 | struct nlm_block *block; |
| 446 | int status = 0; | ||
| 447 | 447 | ||
| 448 | dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", | 448 | dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n", |
| 449 | file->f_file->f_dentry->d_inode->i_sb->s_id, | 449 | file->f_file->f_dentry->d_inode->i_sb->s_id, |
| @@ -454,9 +454,9 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock) | |||
| 454 | 454 | ||
| 455 | down(&file->f_sema); | 455 | down(&file->f_sema); |
| 456 | if ((block = nlmsvc_lookup_block(file, lock, 1)) != NULL) | 456 | if ((block = nlmsvc_lookup_block(file, lock, 1)) != NULL) |
| 457 | nlmsvc_delete_block(block, 1); | 457 | status = nlmsvc_delete_block(block, 1); |
| 458 | up(&file->f_sema); | 458 | up(&file->f_sema); |
| 459 | return nlm_granted; | 459 | return status ? nlm_lck_denied : nlm_granted; |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | /* | 462 | /* |
| @@ -562,7 +562,7 @@ callback: | |||
| 562 | /* Call the client */ | 562 | /* Call the client */ |
| 563 | nlm_get_host(block->b_call.a_host); | 563 | nlm_get_host(block->b_call.a_host); |
| 564 | if (nlmsvc_async_call(&block->b_call, NLMPROC_GRANTED_MSG, | 564 | if (nlmsvc_async_call(&block->b_call, NLMPROC_GRANTED_MSG, |
| 565 | nlmsvc_grant_callback) < 0) | 565 | &nlmsvc_grant_ops) < 0) |
| 566 | nlm_release_host(block->b_call.a_host); | 566 | nlm_release_host(block->b_call.a_host); |
| 567 | up(&file->f_sema); | 567 | up(&file->f_sema); |
| 568 | } | 568 | } |
| @@ -575,10 +575,9 @@ callback: | |||
| 575 | * chain once more in order to have it removed by lockd itself (which can | 575 | * chain once more in order to have it removed by lockd itself (which can |
| 576 | * then sleep on the file semaphore without disrupting e.g. the nfs client). | 576 | * then sleep on the file semaphore without disrupting e.g. the nfs client). |
| 577 | */ | 577 | */ |
| 578 | static void | 578 | static void nlmsvc_grant_callback(struct rpc_task *task, void *data) |
| 579 | nlmsvc_grant_callback(struct rpc_task *task) | ||
| 580 | { | 579 | { |
| 581 | struct nlm_rqst *call = (struct nlm_rqst *) task->tk_calldata; | 580 | struct nlm_rqst *call = data; |
| 582 | struct nlm_block *block; | 581 | struct nlm_block *block; |
| 583 | unsigned long timeout; | 582 | unsigned long timeout; |
| 584 | struct sockaddr_in *peer_addr = RPC_PEERADDR(task->tk_client); | 583 | struct sockaddr_in *peer_addr = RPC_PEERADDR(task->tk_client); |
| @@ -614,6 +613,10 @@ nlmsvc_grant_callback(struct rpc_task *task) | |||
| 614 | nlm_release_host(call->a_host); | 613 | nlm_release_host(call->a_host); |
| 615 | } | 614 | } |
| 616 | 615 | ||
| 616 | static const struct rpc_call_ops nlmsvc_grant_ops = { | ||
| 617 | .rpc_call_done = nlmsvc_grant_callback, | ||
| 618 | }; | ||
| 619 | |||
| 617 | /* | 620 | /* |
| 618 | * We received a GRANT_RES callback. Try to find the corresponding | 621 | * We received a GRANT_RES callback. Try to find the corresponding |
| 619 | * block. | 622 | * block. |
| @@ -633,11 +636,12 @@ nlmsvc_grant_reply(struct svc_rqst *rqstp, struct nlm_cookie *cookie, u32 status | |||
| 633 | 636 | ||
| 634 | file->f_count++; | 637 | file->f_count++; |
| 635 | down(&file->f_sema); | 638 | down(&file->f_sema); |
| 636 | if ((block = nlmsvc_find_block(cookie,&rqstp->rq_addr)) != NULL) { | 639 | block = nlmsvc_find_block(cookie, &rqstp->rq_addr); |
| 640 | if (block) { | ||
| 637 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { | 641 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { |
| 638 | /* Try again in a couple of seconds */ | 642 | /* Try again in a couple of seconds */ |
| 639 | nlmsvc_insert_block(block, 10 * HZ); | 643 | nlmsvc_insert_block(block, 10 * HZ); |
| 640 | block = NULL; | 644 | up(&file->f_sema); |
| 641 | } else { | 645 | } else { |
| 642 | /* Lock is now held by client, or has been rejected. | 646 | /* Lock is now held by client, or has been rejected. |
| 643 | * In both cases, the block should be removed. */ | 647 | * In both cases, the block should be removed. */ |
| @@ -648,8 +652,6 @@ nlmsvc_grant_reply(struct svc_rqst *rqstp, struct nlm_cookie *cookie, u32 status | |||
| 648 | nlmsvc_delete_block(block, 1); | 652 | nlmsvc_delete_block(block, 1); |
| 649 | } | 653 | } |
| 650 | } | 654 | } |
| 651 | if (!block) | ||
| 652 | up(&file->f_sema); | ||
| 653 | nlm_release_file(file); | 655 | nlm_release_file(file); |
| 654 | } | 656 | } |
| 655 | 657 | ||
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 757e344cf200..3bc437e0cf5b 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
| @@ -23,7 +23,8 @@ | |||
| 23 | #define NLMDBG_FACILITY NLMDBG_CLIENT | 23 | #define NLMDBG_FACILITY NLMDBG_CLIENT |
| 24 | 24 | ||
| 25 | static u32 nlmsvc_callback(struct svc_rqst *, u32, struct nlm_res *); | 25 | static u32 nlmsvc_callback(struct svc_rqst *, u32, struct nlm_res *); |
| 26 | static void nlmsvc_callback_exit(struct rpc_task *); | 26 | |
| 27 | static const struct rpc_call_ops nlmsvc_callback_ops; | ||
| 27 | 28 | ||
| 28 | #ifdef CONFIG_LOCKD_V4 | 29 | #ifdef CONFIG_LOCKD_V4 |
| 29 | static u32 | 30 | static u32 |
| @@ -518,7 +519,7 @@ nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp) | |||
| 518 | call->a_host = host; | 519 | call->a_host = host; |
| 519 | memcpy(&call->a_args, resp, sizeof(*resp)); | 520 | memcpy(&call->a_args, resp, sizeof(*resp)); |
| 520 | 521 | ||
| 521 | if (nlmsvc_async_call(call, proc, nlmsvc_callback_exit) < 0) | 522 | if (nlmsvc_async_call(call, proc, &nlmsvc_callback_ops) < 0) |
| 522 | goto error; | 523 | goto error; |
| 523 | 524 | ||
| 524 | return rpc_success; | 525 | return rpc_success; |
| @@ -528,10 +529,9 @@ nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_res *resp) | |||
| 528 | return rpc_system_err; | 529 | return rpc_system_err; |
| 529 | } | 530 | } |
| 530 | 531 | ||
| 531 | static void | 532 | static void nlmsvc_callback_exit(struct rpc_task *task, void *data) |
| 532 | nlmsvc_callback_exit(struct rpc_task *task) | ||
| 533 | { | 533 | { |
| 534 | struct nlm_rqst *call = (struct nlm_rqst *) task->tk_calldata; | 534 | struct nlm_rqst *call = data; |
| 535 | 535 | ||
| 536 | if (task->tk_status < 0) { | 536 | if (task->tk_status < 0) { |
| 537 | dprintk("lockd: %4d callback failed (errno = %d)\n", | 537 | dprintk("lockd: %4d callback failed (errno = %d)\n", |
| @@ -541,6 +541,10 @@ nlmsvc_callback_exit(struct rpc_task *task) | |||
| 541 | kfree(call); | 541 | kfree(call); |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | static const struct rpc_call_ops nlmsvc_callback_ops = { | ||
| 545 | .rpc_call_done = nlmsvc_callback_exit, | ||
| 546 | }; | ||
| 547 | |||
| 544 | /* | 548 | /* |
| 545 | * NLM Server procedures. | 549 | * NLM Server procedures. |
| 546 | */ | 550 | */ |
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index f01e9c0d2677..200fbda2c6d1 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
| @@ -44,7 +44,7 @@ loff_t_to_s32(loff_t offset) | |||
| 44 | /* | 44 | /* |
| 45 | * XDR functions for basic NLM types | 45 | * XDR functions for basic NLM types |
| 46 | */ | 46 | */ |
| 47 | static inline u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) | 47 | static u32 *nlm_decode_cookie(u32 *p, struct nlm_cookie *c) |
| 48 | { | 48 | { |
| 49 | unsigned int len; | 49 | unsigned int len; |
| 50 | 50 | ||
| @@ -79,7 +79,7 @@ nlm_encode_cookie(u32 *p, struct nlm_cookie *c) | |||
| 79 | return p; | 79 | return p; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static inline u32 * | 82 | static u32 * |
| 83 | nlm_decode_fh(u32 *p, struct nfs_fh *f) | 83 | nlm_decode_fh(u32 *p, struct nfs_fh *f) |
| 84 | { | 84 | { |
| 85 | unsigned int len; | 85 | unsigned int len; |
| @@ -119,7 +119,7 @@ nlm_encode_oh(u32 *p, struct xdr_netobj *oh) | |||
| 119 | return xdr_encode_netobj(p, oh); | 119 | return xdr_encode_netobj(p, oh); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static inline u32 * | 122 | static u32 * |
| 123 | nlm_decode_lock(u32 *p, struct nlm_lock *lock) | 123 | nlm_decode_lock(u32 *p, struct nlm_lock *lock) |
| 124 | { | 124 | { |
| 125 | struct file_lock *fl = &lock->fl; | 125 | struct file_lock *fl = &lock->fl; |
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c index ae4d6b426c62..fdcf105a5303 100644 --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c | |||
| @@ -354,7 +354,9 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp) | |||
| 354 | return 0; | 354 | return 0; |
| 355 | argp->state = ntohl(*p++); | 355 | argp->state = ntohl(*p++); |
| 356 | /* Preserve the address in network byte order */ | 356 | /* Preserve the address in network byte order */ |
| 357 | argp->addr = *p++; | 357 | argp->addr = *p++; |
| 358 | argp->vers = *p++; | ||
| 359 | argp->proto = *p++; | ||
| 358 | return xdr_argsize_check(rqstp, p); | 360 | return xdr_argsize_check(rqstp, p); |
| 359 | } | 361 | } |
| 360 | 362 | ||
