diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 19:45:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 19:45:47 -0500 |
commit | 75659ca0c10992dcb39258518368a0f6f56e935d (patch) | |
tree | 5d014ceb2f10158061a23d0d976f9a613d85e659 /net | |
parent | fbdde7bd274d74729954190f99afcb1e3d9bbfba (diff) | |
parent | 2dfe485a2c8afa54cb069fcf48476f6c90ea3fdf (diff) |
Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc
* 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc: (22 commits)
Remove commented-out code copied from NFS
NFS: Switch from intr mount option to TASK_KILLABLE
Add wait_for_completion_killable
Add wait_event_killable
Add schedule_timeout_killable
Use mutex_lock_killable in vfs_readdir
Add mutex_lock_killable
Use lock_page_killable
Add lock_page_killable
Add fatal_signal_pending
Add TASK_WAKEKILL
exit: Use task_is_*
signal: Use task_is_*
sched: Use task_contributes_to_load, TASK_ALL and TASK_NORMAL
ptrace: Use task_is_*
power: Use task_is_*
wait: Use TASK_NORMAL
proc/base.c: Use task_is_*
proc/array.c: Use TASK_REPORT
perfmon: Use task_is_*
...
Fixed up conflicts in NFS/sunrpc manually..
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth.c | 3 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 55 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 3 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 15 |
4 files changed, 10 insertions, 66 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index bcd9abdb031c..eca941ce298b 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -385,7 +385,6 @@ rpcauth_bindcred(struct rpc_task *task) | |||
385 | .group_info = current->group_info, | 385 | .group_info = current->group_info, |
386 | }; | 386 | }; |
387 | struct rpc_cred *ret; | 387 | struct rpc_cred *ret; |
388 | sigset_t oldset; | ||
389 | int flags = 0; | 388 | int flags = 0; |
390 | 389 | ||
391 | dprintk("RPC: %5u looking up %s cred\n", | 390 | dprintk("RPC: %5u looking up %s cred\n", |
@@ -393,9 +392,7 @@ rpcauth_bindcred(struct rpc_task *task) | |||
393 | get_group_info(acred.group_info); | 392 | get_group_info(acred.group_info); |
394 | if (task->tk_flags & RPC_TASK_ROOTCREDS) | 393 | if (task->tk_flags & RPC_TASK_ROOTCREDS) |
395 | flags |= RPCAUTH_LOOKUP_ROOTCREDS; | 394 | flags |= RPCAUTH_LOOKUP_ROOTCREDS; |
396 | rpc_clnt_sigmask(task->tk_client, &oldset); | ||
397 | ret = auth->au_ops->lookup_cred(auth, &acred, flags); | 395 | ret = auth->au_ops->lookup_cred(auth, &acred, flags); |
398 | rpc_clnt_sigunmask(task->tk_client, &oldset); | ||
399 | if (!IS_ERR(ret)) | 396 | if (!IS_ERR(ret)) |
400 | task->tk_msg.rpc_cred = ret; | 397 | task->tk_msg.rpc_cred = ret; |
401 | else | 398 | else |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 924916ceaa43..0998e6d09664 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -313,7 +313,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
313 | return clnt; | 313 | return clnt; |
314 | 314 | ||
315 | if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { | 315 | if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { |
316 | int err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR); | 316 | int err = rpc_ping(clnt, RPC_TASK_SOFT); |
317 | if (err != 0) { | 317 | if (err != 0) { |
318 | rpc_shutdown_client(clnt); | 318 | rpc_shutdown_client(clnt); |
319 | return ERR_PTR(err); | 319 | return ERR_PTR(err); |
@@ -324,8 +324,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
324 | if (args->flags & RPC_CLNT_CREATE_HARDRTRY) | 324 | if (args->flags & RPC_CLNT_CREATE_HARDRTRY) |
325 | clnt->cl_softrtry = 0; | 325 | clnt->cl_softrtry = 0; |
326 | 326 | ||
327 | if (args->flags & RPC_CLNT_CREATE_INTR) | ||
328 | clnt->cl_intr = 1; | ||
329 | if (args->flags & RPC_CLNT_CREATE_AUTOBIND) | 327 | if (args->flags & RPC_CLNT_CREATE_AUTOBIND) |
330 | clnt->cl_autobind = 1; | 328 | clnt->cl_autobind = 1; |
331 | if (args->flags & RPC_CLNT_CREATE_DISCRTRY) | 329 | if (args->flags & RPC_CLNT_CREATE_DISCRTRY) |
@@ -493,7 +491,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, | |||
493 | clnt->cl_prog = program->number; | 491 | clnt->cl_prog = program->number; |
494 | clnt->cl_vers = version->number; | 492 | clnt->cl_vers = version->number; |
495 | clnt->cl_stats = program->stats; | 493 | clnt->cl_stats = program->stats; |
496 | err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR); | 494 | err = rpc_ping(clnt, RPC_TASK_SOFT); |
497 | if (err != 0) { | 495 | if (err != 0) { |
498 | rpc_shutdown_client(clnt); | 496 | rpc_shutdown_client(clnt); |
499 | clnt = ERR_PTR(err); | 497 | clnt = ERR_PTR(err); |
@@ -515,46 +513,6 @@ static const struct rpc_call_ops rpc_default_ops = { | |||
515 | .rpc_call_done = rpc_default_callback, | 513 | .rpc_call_done = rpc_default_callback, |
516 | }; | 514 | }; |
517 | 515 | ||
518 | /* | ||
519 | * Export the signal mask handling for synchronous code that | ||
520 | * sleeps on RPC calls | ||
521 | */ | ||
522 | #define RPC_INTR_SIGNALS (sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTERM)) | ||
523 | |||
524 | static void rpc_save_sigmask(sigset_t *oldset, int intr) | ||
525 | { | ||
526 | unsigned long sigallow = sigmask(SIGKILL); | ||
527 | sigset_t sigmask; | ||
528 | |||
529 | /* Block all signals except those listed in sigallow */ | ||
530 | if (intr) | ||
531 | sigallow |= RPC_INTR_SIGNALS; | ||
532 | siginitsetinv(&sigmask, sigallow); | ||
533 | sigprocmask(SIG_BLOCK, &sigmask, oldset); | ||
534 | } | ||
535 | |||
536 | static void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset) | ||
537 | { | ||
538 | rpc_save_sigmask(oldset, !RPC_TASK_UNINTERRUPTIBLE(task)); | ||
539 | } | ||
540 | |||
541 | static void rpc_restore_sigmask(sigset_t *oldset) | ||
542 | { | ||
543 | sigprocmask(SIG_SETMASK, oldset, NULL); | ||
544 | } | ||
545 | |||
546 | void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset) | ||
547 | { | ||
548 | rpc_save_sigmask(oldset, clnt->cl_intr); | ||
549 | } | ||
550 | EXPORT_SYMBOL_GPL(rpc_clnt_sigmask); | ||
551 | |||
552 | void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset) | ||
553 | { | ||
554 | rpc_restore_sigmask(oldset); | ||
555 | } | ||
556 | EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask); | ||
557 | |||
558 | /** | 516 | /** |
559 | * rpc_run_task - Allocate a new RPC task, then run rpc_execute against it | 517 | * rpc_run_task - Allocate a new RPC task, then run rpc_execute against it |
560 | * @task_setup_data: pointer to task initialisation data | 518 | * @task_setup_data: pointer to task initialisation data |
@@ -562,7 +520,6 @@ EXPORT_SYMBOL_GPL(rpc_clnt_sigunmask); | |||
562 | struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data) | 520 | struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data) |
563 | { | 521 | { |
564 | struct rpc_task *task, *ret; | 522 | struct rpc_task *task, *ret; |
565 | sigset_t oldset; | ||
566 | 523 | ||
567 | task = rpc_new_task(task_setup_data); | 524 | task = rpc_new_task(task_setup_data); |
568 | if (task == NULL) { | 525 | if (task == NULL) { |
@@ -578,13 +535,7 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data) | |||
578 | goto out; | 535 | goto out; |
579 | } | 536 | } |
580 | atomic_inc(&task->tk_count); | 537 | atomic_inc(&task->tk_count); |
581 | /* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */ | 538 | rpc_execute(task); |
582 | if (!RPC_IS_ASYNC(task)) { | ||
583 | rpc_task_sigmask(task, &oldset); | ||
584 | rpc_execute(task); | ||
585 | rpc_restore_sigmask(&oldset); | ||
586 | } else | ||
587 | rpc_execute(task); | ||
588 | ret = task; | 539 | ret = task; |
589 | out: | 540 | out: |
590 | return ret; | 541 | return ret; |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index fa5b8f202d5b..3164a0871cf0 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -120,8 +120,7 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | |||
120 | .program = &rpcb_program, | 120 | .program = &rpcb_program, |
121 | .version = version, | 121 | .version = version, |
122 | .authflavor = RPC_AUTH_UNIX, | 122 | .authflavor = RPC_AUTH_UNIX, |
123 | .flags = (RPC_CLNT_CREATE_NOPING | | 123 | .flags = RPC_CLNT_CREATE_NOPING, |
124 | RPC_CLNT_CREATE_INTR), | ||
125 | }; | 124 | }; |
126 | 125 | ||
127 | switch (srvaddr->sa_family) { | 126 | switch (srvaddr->sa_family) { |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 40ce6f6672d6..4c669121e607 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_GPL(rpc_init_wait_queue); | 246 | EXPORT_SYMBOL_GPL(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_GPL(__rpc_wait_for_completion_task); | 306 | EXPORT_SYMBOL_GPL(__rpc_wait_for_completion_task); |
307 | 307 | ||
@@ -696,10 +696,9 @@ static void __rpc_execute(struct rpc_task *task) | |||
696 | 696 | ||
697 | /* sync task: sleep here */ | 697 | /* sync task: sleep here */ |
698 | dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); | 698 | dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); |
699 | /* Note: Caller should be using rpc_clnt_sigmask() */ | ||
700 | status = out_of_line_wait_on_bit(&task->tk_runstate, | 699 | status = out_of_line_wait_on_bit(&task->tk_runstate, |
701 | RPC_TASK_QUEUED, rpc_wait_bit_interruptible, | 700 | RPC_TASK_QUEUED, rpc_wait_bit_killable, |
702 | TASK_INTERRUPTIBLE); | 701 | TASK_KILLABLE); |
703 | if (status == -ERESTARTSYS) { | 702 | if (status == -ERESTARTSYS) { |
704 | /* | 703 | /* |
705 | * When a sync task receives a signal, it exits with | 704 | * When a sync task receives a signal, it exits with |
@@ -840,8 +839,6 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta | |||
840 | kref_get(&task->tk_client->cl_kref); | 839 | kref_get(&task->tk_client->cl_kref); |
841 | if (task->tk_client->cl_softrtry) | 840 | if (task->tk_client->cl_softrtry) |
842 | task->tk_flags |= RPC_TASK_SOFT; | 841 | task->tk_flags |= RPC_TASK_SOFT; |
843 | if (!task->tk_client->cl_intr) | ||
844 | task->tk_flags |= RPC_TASK_NOINTR; | ||
845 | } | 842 | } |
846 | 843 | ||
847 | if (task->tk_ops->rpc_call_prepare != NULL) | 844 | if (task->tk_ops->rpc_call_prepare != NULL) |