diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-12-06 16:24:39 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@linux.intel.com> | 2007-12-06 17:40:25 -0500 |
commit | 150030b78a454ba50d5e267b0dcf01b162809192 (patch) | |
tree | 4de766e7abbfd73a052f14f8efd3a26eb7b59d87 /net | |
parent | 009e577e079656d51d0fe9b15e61e41b00816c29 (diff) |
NFS: Switch from intr mount option to TASK_KILLABLE
By using the TASK_KILLABLE infrastructure, we can get rid of the 'intr'
mount option. We have to use _killable everywhere instead of _interruptible
as we get rid of rpc_clnt_sigmask/sigunmask.
Signed-off-by: Liam R. Howlett <howlett@gmail.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/clnt.c | 47 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 3 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 15 | ||||
-rw-r--r-- | net/sunrpc/sunrpc_syms.c | 2 |
4 files changed, 9 insertions, 58 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 76be83ee4b04..a99729ff450e 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -281,7 +281,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
281 | return clnt; | 281 | return clnt; |
282 | 282 | ||
283 | if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { | 283 | if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { |
284 | int err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR); | 284 | int err = rpc_ping(clnt, RPC_TASK_SOFT); |
285 | if (err != 0) { | 285 | if (err != 0) { |
286 | rpc_shutdown_client(clnt); | 286 | rpc_shutdown_client(clnt); |
287 | return ERR_PTR(err); | 287 | return ERR_PTR(err); |
@@ -292,8 +292,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
292 | if (args->flags & RPC_CLNT_CREATE_HARDRTRY) | 292 | if (args->flags & RPC_CLNT_CREATE_HARDRTRY) |
293 | clnt->cl_softrtry = 0; | 293 | clnt->cl_softrtry = 0; |
294 | 294 | ||
295 | if (args->flags & RPC_CLNT_CREATE_INTR) | ||
296 | clnt->cl_intr = 1; | ||
297 | if (args->flags & RPC_CLNT_CREATE_AUTOBIND) | 295 | if (args->flags & RPC_CLNT_CREATE_AUTOBIND) |
298 | clnt->cl_autobind = 1; | 296 | clnt->cl_autobind = 1; |
299 | if (args->flags & RPC_CLNT_CREATE_DISCRTRY) | 297 | if (args->flags & RPC_CLNT_CREATE_DISCRTRY) |
@@ -459,7 +457,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, | |||
459 | clnt->cl_prog = program->number; | 457 | clnt->cl_prog = program->number; |
460 | clnt->cl_vers = version->number; | 458 | clnt->cl_vers = version->number; |
461 | clnt->cl_stats = program->stats; | 459 | clnt->cl_stats = program->stats; |
462 | err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR); | 460 | err = rpc_ping(clnt, RPC_TASK_SOFT); |
463 | if (err != 0) { | 461 | if (err != 0) { |
464 | rpc_shutdown_client(clnt); | 462 | rpc_shutdown_client(clnt); |
465 | clnt = ERR_PTR(err); | 463 | clnt = ERR_PTR(err); |
@@ -480,44 +478,6 @@ static const struct rpc_call_ops rpc_default_ops = { | |||
480 | .rpc_call_done = rpc_default_callback, | 478 | .rpc_call_done = rpc_default_callback, |
481 | }; | 479 | }; |
482 | 480 | ||
483 | /* | ||
484 | * Export the signal mask handling for synchronous code that | ||
485 | * sleeps on RPC calls | ||
486 | */ | ||
487 | #define RPC_INTR_SIGNALS (sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTERM)) | ||
488 | |||
489 | static void rpc_save_sigmask(sigset_t *oldset, int intr) | ||
490 | { | ||
491 | unsigned long sigallow = sigmask(SIGKILL); | ||
492 | sigset_t sigmask; | ||
493 | |||
494 | /* Block all signals except those listed in sigallow */ | ||
495 | if (intr) | ||
496 | sigallow |= RPC_INTR_SIGNALS; | ||
497 | siginitsetinv(&sigmask, sigallow); | ||
498 | sigprocmask(SIG_BLOCK, &sigmask, oldset); | ||
499 | } | ||
500 | |||
501 | static inline void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset) | ||
502 | { | ||
503 | rpc_save_sigmask(oldset, !RPC_TASK_UNINTERRUPTIBLE(task)); | ||
504 | } | ||
505 | |||
506 | static inline void rpc_restore_sigmask(sigset_t *oldset) | ||
507 | { | ||
508 | sigprocmask(SIG_SETMASK, oldset, NULL); | ||
509 | } | ||
510 | |||
511 | void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset) | ||
512 | { | ||
513 | rpc_save_sigmask(oldset, clnt->cl_intr); | ||
514 | } | ||
515 | |||
516 | void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset) | ||
517 | { | ||
518 | rpc_restore_sigmask(oldset); | ||
519 | } | ||
520 | |||
521 | static | 481 | static |
522 | struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, | 482 | struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, |
523 | struct rpc_message *msg, | 483 | struct rpc_message *msg, |
@@ -526,7 +486,6 @@ struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, | |||
526 | void *data) | 486 | void *data) |
527 | { | 487 | { |
528 | struct rpc_task *task, *ret; | 488 | struct rpc_task *task, *ret; |
529 | sigset_t oldset; | ||
530 | 489 | ||
531 | task = rpc_new_task(clnt, flags, ops, data); | 490 | task = rpc_new_task(clnt, flags, ops, data); |
532 | if (task == NULL) { | 491 | if (task == NULL) { |
@@ -535,7 +494,6 @@ struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, | |||
535 | } | 494 | } |
536 | 495 | ||
537 | /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */ | 496 | /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */ |
538 | rpc_task_sigmask(task, &oldset); | ||
539 | if (msg != NULL) { | 497 | if (msg != NULL) { |
540 | rpc_call_setup(task, msg, 0); | 498 | rpc_call_setup(task, msg, 0); |
541 | if (task->tk_status != 0) { | 499 | if (task->tk_status != 0) { |
@@ -548,7 +506,6 @@ struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, | |||
548 | rpc_execute(task); | 506 | rpc_execute(task); |
549 | ret = task; | 507 | ret = task; |
550 | out: | 508 | out: |
551 | rpc_restore_sigmask(&oldset); | ||
552 | return ret; | 509 | return ret; |
553 | } | 510 | } |
554 | 511 | ||
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index a05493aedb68..c35b6e7fc680 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -172,8 +172,7 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | |||
172 | .program = &rpcb_program, | 172 | .program = &rpcb_program, |
173 | .version = version, | 173 | .version = version, |
174 | .authflavor = RPC_AUTH_UNIX, | 174 | .authflavor = RPC_AUTH_UNIX, |
175 | .flags = (RPC_CLNT_CREATE_NOPING | | 175 | .flags = RPC_CLNT_CREATE_NOPING, |
176 | RPC_CLNT_CREATE_INTR), | ||
177 | }; | 176 | }; |
178 | 177 | ||
179 | switch (srvaddr->sa_family) { | 178 | switch (srvaddr->sa_family) { |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index c98873f39aec..4b22910b4461 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -245,9 +245,9 @@ void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname) | |||
245 | } | 245 | } |
246 | EXPORT_SYMBOL(rpc_init_wait_queue); | 246 | EXPORT_SYMBOL(rpc_init_wait_queue); |
247 | 247 | ||
248 | static int rpc_wait_bit_interruptible(void *word) | 248 | static int rpc_wait_bit_killable(void *word) |
249 | { | 249 | { |
250 | if (signal_pending(current)) | 250 | if (fatal_signal_pending(current)) |
251 | return -ERESTARTSYS; | 251 | return -ERESTARTSYS; |
252 | schedule(); | 252 | schedule(); |
253 | return 0; | 253 | return 0; |
@@ -299,9 +299,9 @@ static void rpc_mark_complete_task(struct rpc_task *task) | |||
299 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *)) | 299 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *)) |
300 | { | 300 | { |
301 | if (action == NULL) | 301 | if (action == NULL) |
302 | action = rpc_wait_bit_interruptible; | 302 | action = rpc_wait_bit_killable; |
303 | return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE, | 303 | return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE, |
304 | action, TASK_INTERRUPTIBLE); | 304 | action, TASK_KILLABLE); |
305 | } | 305 | } |
306 | EXPORT_SYMBOL(__rpc_wait_for_completion_task); | 306 | EXPORT_SYMBOL(__rpc_wait_for_completion_task); |
307 | 307 | ||
@@ -690,10 +690,9 @@ static void __rpc_execute(struct rpc_task *task) | |||
690 | 690 | ||
691 | /* sync task: sleep here */ | 691 | /* sync task: sleep here */ |
692 | dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); | 692 | dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); |
693 | /* Note: Caller should be using rpc_clnt_sigmask() */ | ||
694 | status = out_of_line_wait_on_bit(&task->tk_runstate, | 693 | status = out_of_line_wait_on_bit(&task->tk_runstate, |
695 | RPC_TASK_QUEUED, rpc_wait_bit_interruptible, | 694 | RPC_TASK_QUEUED, rpc_wait_bit_killable, |
696 | TASK_INTERRUPTIBLE); | 695 | TASK_KILLABLE); |
697 | if (status == -ERESTARTSYS) { | 696 | if (status == -ERESTARTSYS) { |
698 | /* | 697 | /* |
699 | * When a sync task receives a signal, it exits with | 698 | * When a sync task receives a signal, it exits with |
@@ -837,8 +836,6 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons | |||
837 | kref_get(&clnt->cl_kref); | 836 | kref_get(&clnt->cl_kref); |
838 | if (clnt->cl_softrtry) | 837 | if (clnt->cl_softrtry) |
839 | task->tk_flags |= RPC_TASK_SOFT; | 838 | task->tk_flags |= RPC_TASK_SOFT; |
840 | if (!clnt->cl_intr) | ||
841 | task->tk_flags |= RPC_TASK_NOINTR; | ||
842 | } | 839 | } |
843 | 840 | ||
844 | BUG_ON(task->tk_ops == NULL); | 841 | BUG_ON(task->tk_ops == NULL); |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 33d89e842c85..1fd3aa81938a 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
@@ -38,8 +38,6 @@ EXPORT_SYMBOL(rpc_killall_tasks); | |||
38 | EXPORT_SYMBOL(rpc_call_sync); | 38 | EXPORT_SYMBOL(rpc_call_sync); |
39 | EXPORT_SYMBOL(rpc_call_async); | 39 | EXPORT_SYMBOL(rpc_call_async); |
40 | EXPORT_SYMBOL(rpc_call_setup); | 40 | EXPORT_SYMBOL(rpc_call_setup); |
41 | EXPORT_SYMBOL(rpc_clnt_sigmask); | ||
42 | EXPORT_SYMBOL(rpc_clnt_sigunmask); | ||
43 | EXPORT_SYMBOL(rpc_delay); | 41 | EXPORT_SYMBOL(rpc_delay); |
44 | EXPORT_SYMBOL(rpc_restart_call); | 42 | EXPORT_SYMBOL(rpc_restart_call); |
45 | EXPORT_SYMBOL(rpc_setbufsize); | 43 | EXPORT_SYMBOL(rpc_setbufsize); |