diff options
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 55 |
1 files changed, 3 insertions, 52 deletions
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; |