aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-31 19:45:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-31 19:45:47 -0500
commit75659ca0c10992dcb39258518368a0f6f56e935d (patch)
tree5d014ceb2f10158061a23d0d976f9a613d85e659 /net/sunrpc/clnt.c
parentfbdde7bd274d74729954190f99afcb1e3d9bbfba (diff)
parent2dfe485a2c8afa54cb069fcf48476f6c90ea3fdf (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/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c55
1 files changed, 3 insertions, 52 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 924916ceaa4..0998e6d0966 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
524static 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
536static void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset)
537{
538 rpc_save_sigmask(oldset, !RPC_TASK_UNINTERRUPTIBLE(task));
539}
540
541static void rpc_restore_sigmask(sigset_t *oldset)
542{
543 sigprocmask(SIG_SETMASK, oldset, NULL);
544}
545
546void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset)
547{
548 rpc_save_sigmask(oldset, clnt->cl_intr);
549}
550EXPORT_SYMBOL_GPL(rpc_clnt_sigmask);
551
552void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
553{
554 rpc_restore_sigmask(oldset);
555}
556EXPORT_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);
562struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data) 520struct 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;
589out: 540out:
590 return ret; 541 return ret;