aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r--net/sunrpc/clnt.c47
1 files changed, 2 insertions, 45 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
489static 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
501static inline void rpc_task_sigmask(struct rpc_task *task, sigset_t *oldset)
502{
503 rpc_save_sigmask(oldset, !RPC_TASK_UNINTERRUPTIBLE(task));
504}
505
506static inline void rpc_restore_sigmask(sigset_t *oldset)
507{
508 sigprocmask(SIG_SETMASK, oldset, NULL);
509}
510
511void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset)
512{
513 rpc_save_sigmask(oldset, clnt->cl_intr);
514}
515
516void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
517{
518 rpc_restore_sigmask(oldset);
519}
520
521static 481static
522struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt, 482struct 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;
550out: 508out:
551 rpc_restore_sigmask(&oldset);
552 return ret; 509 return ret;
553} 510}
554 511