aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/clnt.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-12-06 16:24:39 -0500
committerMatthew Wilcox <willy@linux.intel.com>2007-12-06 17:40:25 -0500
commit150030b78a454ba50d5e267b0dcf01b162809192 (patch)
tree4de766e7abbfd73a052f14f8efd3a26eb7b59d87 /net/sunrpc/clnt.c
parent009e577e079656d51d0fe9b15e61e41b00816c29 (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/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