aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--fs/nfs/client.c6
-rw-r--r--fs/nfs/direct.c10
-rw-r--r--fs/nfs/inode.c6
-rw-r--r--fs/nfs/mount_clnt.c2
-rw-r--r--fs/nfs/nfs3proc.c7
-rw-r--r--fs/nfs/nfs4proc.c27
-rw-r--r--fs/nfs/nfsroot.c3
-rw-r--r--fs/nfs/pagelist.c18
-rw-r--r--fs/nfs/read.c5
-rw-r--r--fs/nfs/super.c4
-rw-r--r--fs/nfs/write.c7
-rw-r--r--include/linux/nfs_fs.h9
-rw-r--r--include/linux/nfs_mount.h2
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/sched.h2
-rw-r--r--net/sunrpc/clnt.c47
-rw-r--r--net/sunrpc/rpcb_clnt.c3
-rw-r--r--net/sunrpc/sched.c15
-rw-r--r--net/sunrpc/sunrpc_syms.c2
19 files changed, 30 insertions, 147 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 70587f383f10..310fa2f4cbb8 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -302,7 +302,7 @@ found_client:
302 if (new) 302 if (new)
303 nfs_free_client(new); 303 nfs_free_client(new);
304 304
305 error = wait_event_interruptible(nfs_client_active_wq, 305 error = wait_event_killable(nfs_client_active_wq,
306 clp->cl_cons_state != NFS_CS_INITING); 306 clp->cl_cons_state != NFS_CS_INITING);
307 if (error < 0) { 307 if (error < 0) {
308 nfs_put_client(clp); 308 nfs_put_client(clp);
@@ -494,10 +494,6 @@ static int nfs_init_server_rpcclient(struct nfs_server *server, rpc_authflavor_t
494 if (server->flags & NFS_MOUNT_SOFT) 494 if (server->flags & NFS_MOUNT_SOFT)
495 server->client->cl_softrtry = 1; 495 server->client->cl_softrtry = 1;
496 496
497 server->client->cl_intr = 0;
498 if (server->flags & NFS4_MOUNT_INTR)
499 server->client->cl_intr = 1;
500
501 return 0; 497 return 0;
502} 498}
503 499
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 5e8d82f6666b..7b994b2fa593 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -193,7 +193,7 @@ static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq)
193 if (dreq->iocb) 193 if (dreq->iocb)
194 goto out; 194 goto out;
195 195
196 result = wait_for_completion_interruptible(&dreq->completion); 196 result = wait_for_completion_killable(&dreq->completion);
197 197
198 if (!result) 198 if (!result)
199 result = dreq->error; 199 result = dreq->error;
@@ -391,9 +391,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
391 unsigned long nr_segs, loff_t pos) 391 unsigned long nr_segs, loff_t pos)
392{ 392{
393 ssize_t result = 0; 393 ssize_t result = 0;
394 sigset_t oldset;
395 struct inode *inode = iocb->ki_filp->f_mapping->host; 394 struct inode *inode = iocb->ki_filp->f_mapping->host;
396 struct rpc_clnt *clnt = NFS_CLIENT(inode);
397 struct nfs_direct_req *dreq; 395 struct nfs_direct_req *dreq;
398 396
399 dreq = nfs_direct_req_alloc(); 397 dreq = nfs_direct_req_alloc();
@@ -405,11 +403,9 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov,
405 if (!is_sync_kiocb(iocb)) 403 if (!is_sync_kiocb(iocb))
406 dreq->iocb = iocb; 404 dreq->iocb = iocb;
407 405
408 rpc_clnt_sigmask(clnt, &oldset);
409 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos); 406 result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos);
410 if (!result) 407 if (!result)
411 result = nfs_direct_wait(dreq); 408 result = nfs_direct_wait(dreq);
412 rpc_clnt_sigunmask(clnt, &oldset);
413 nfs_direct_req_release(dreq); 409 nfs_direct_req_release(dreq);
414 410
415 return result; 411 return result;
@@ -767,9 +763,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
767 size_t count) 763 size_t count)
768{ 764{
769 ssize_t result = 0; 765 ssize_t result = 0;
770 sigset_t oldset;
771 struct inode *inode = iocb->ki_filp->f_mapping->host; 766 struct inode *inode = iocb->ki_filp->f_mapping->host;
772 struct rpc_clnt *clnt = NFS_CLIENT(inode);
773 struct nfs_direct_req *dreq; 767 struct nfs_direct_req *dreq;
774 size_t wsize = NFS_SERVER(inode)->wsize; 768 size_t wsize = NFS_SERVER(inode)->wsize;
775 int sync = 0; 769 int sync = 0;
@@ -787,11 +781,9 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov,
787 if (!is_sync_kiocb(iocb)) 781 if (!is_sync_kiocb(iocb))
788 dreq->iocb = iocb; 782 dreq->iocb = iocb;
789 783
790 rpc_clnt_sigmask(clnt, &oldset);
791 result = nfs_direct_write_schedule_iovec(dreq, iov, nr_segs, pos, sync); 784 result = nfs_direct_write_schedule_iovec(dreq, iov, nr_segs, pos, sync);
792 if (!result) 785 if (!result)
793 result = nfs_direct_wait(dreq); 786 result = nfs_direct_wait(dreq);
794 rpc_clnt_sigunmask(clnt, &oldset);
795 nfs_direct_req_release(dreq); 787 nfs_direct_req_release(dreq);
796 788
797 return result; 789 return result;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index db5d96dc6107..f68c22215b14 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -433,15 +433,11 @@ static int nfs_wait_schedule(void *word)
433 */ 433 */
434static int nfs_wait_on_inode(struct inode *inode) 434static int nfs_wait_on_inode(struct inode *inode)
435{ 435{
436 struct rpc_clnt *clnt = NFS_CLIENT(inode);
437 struct nfs_inode *nfsi = NFS_I(inode); 436 struct nfs_inode *nfsi = NFS_I(inode);
438 sigset_t oldmask;
439 int error; 437 int error;
440 438
441 rpc_clnt_sigmask(clnt, &oldmask);
442 error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING, 439 error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING,
443 nfs_wait_schedule, TASK_INTERRUPTIBLE); 440 nfs_wait_schedule, TASK_KILLABLE);
444 rpc_clnt_sigunmask(clnt, &oldmask);
445 441
446 return error; 442 return error;
447} 443}
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 8afd9f7e7a97..49c7cd0502cc 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -56,7 +56,7 @@ int nfs_mount(struct sockaddr *addr, size_t len, char *hostname, char *path,
56 .program = &mnt_program, 56 .program = &mnt_program,
57 .version = version, 57 .version = version,
58 .authflavor = RPC_AUTH_UNIX, 58 .authflavor = RPC_AUTH_UNIX,
59 .flags = RPC_CLNT_CREATE_INTR, 59 .flags = 0,
60 }; 60 };
61 struct rpc_clnt *mnt_clnt; 61 struct rpc_clnt *mnt_clnt;
62 int status; 62 int status;
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 4cdc2361a669..5ae96340f2c2 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -27,17 +27,14 @@
27static int 27static int
28nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags) 28nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
29{ 29{
30 sigset_t oldset;
31 int res; 30 int res;
32 rpc_clnt_sigmask(clnt, &oldset);
33 do { 31 do {
34 res = rpc_call_sync(clnt, msg, flags); 32 res = rpc_call_sync(clnt, msg, flags);
35 if (res != -EJUKEBOX) 33 if (res != -EJUKEBOX)
36 break; 34 break;
37 schedule_timeout_interruptible(NFS_JUKEBOX_RETRY_TIME); 35 schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME);
38 res = -ERESTARTSYS; 36 res = -ERESTARTSYS;
39 } while (!signalled()); 37 } while (!fatal_signal_pending(current));
40 rpc_clnt_sigunmask(clnt, &oldset);
41 return res; 38 return res;
42} 39}
43 40
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f03d9d5f5ba4..c4faa43b36de 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -316,12 +316,9 @@ static void nfs4_opendata_put(struct nfs4_opendata *p)
316 316
317static int nfs4_wait_for_completion_rpc_task(struct rpc_task *task) 317static int nfs4_wait_for_completion_rpc_task(struct rpc_task *task)
318{ 318{
319 sigset_t oldset;
320 int ret; 319 int ret;
321 320
322 rpc_clnt_sigmask(task->tk_client, &oldset);
323 ret = rpc_wait_for_completion_task(task); 321 ret = rpc_wait_for_completion_task(task);
324 rpc_clnt_sigunmask(task->tk_client, &oldset);
325 return ret; 322 return ret;
326} 323}
327 324
@@ -2806,9 +2803,9 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server)
2806 return 0; 2803 return 0;
2807} 2804}
2808 2805
2809static int nfs4_wait_bit_interruptible(void *word) 2806static int nfs4_wait_bit_killable(void *word)
2810{ 2807{
2811 if (signal_pending(current)) 2808 if (fatal_signal_pending(current))
2812 return -ERESTARTSYS; 2809 return -ERESTARTSYS;
2813 schedule(); 2810 schedule();
2814 return 0; 2811 return 0;
@@ -2816,18 +2813,14 @@ static int nfs4_wait_bit_interruptible(void *word)
2816 2813
2817static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp) 2814static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp)
2818{ 2815{
2819 sigset_t oldset;
2820 int res; 2816 int res;
2821 2817
2822 might_sleep(); 2818 might_sleep();
2823 2819
2824 rwsem_acquire(&clp->cl_sem.dep_map, 0, 0, _RET_IP_); 2820 rwsem_acquire(&clp->cl_sem.dep_map, 0, 0, _RET_IP_);
2825 2821
2826 rpc_clnt_sigmask(clnt, &oldset);
2827 res = wait_on_bit(&clp->cl_state, NFS4CLNT_STATE_RECOVER, 2822 res = wait_on_bit(&clp->cl_state, NFS4CLNT_STATE_RECOVER,
2828 nfs4_wait_bit_interruptible, 2823 nfs4_wait_bit_killable, TASK_KILLABLE);
2829 TASK_INTERRUPTIBLE);
2830 rpc_clnt_sigunmask(clnt, &oldset);
2831 2824
2832 rwsem_release(&clp->cl_sem.dep_map, 1, _RET_IP_); 2825 rwsem_release(&clp->cl_sem.dep_map, 1, _RET_IP_);
2833 return res; 2826 return res;
@@ -2835,7 +2828,6 @@ static int nfs4_wait_clnt_recover(struct rpc_clnt *clnt, struct nfs_client *clp)
2835 2828
2836static int nfs4_delay(struct rpc_clnt *clnt, long *timeout) 2829static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
2837{ 2830{
2838 sigset_t oldset;
2839 int res = 0; 2831 int res = 0;
2840 2832
2841 might_sleep(); 2833 might_sleep();
@@ -2844,14 +2836,9 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
2844 *timeout = NFS4_POLL_RETRY_MIN; 2836 *timeout = NFS4_POLL_RETRY_MIN;
2845 if (*timeout > NFS4_POLL_RETRY_MAX) 2837 if (*timeout > NFS4_POLL_RETRY_MAX)
2846 *timeout = NFS4_POLL_RETRY_MAX; 2838 *timeout = NFS4_POLL_RETRY_MAX;
2847 rpc_clnt_sigmask(clnt, &oldset); 2839 schedule_timeout_killable(*timeout);
2848 if (clnt->cl_intr) { 2840 if (fatal_signal_pending(current))
2849 schedule_timeout_interruptible(*timeout); 2841 res = -ERESTARTSYS;
2850 if (signalled())
2851 res = -ERESTARTSYS;
2852 } else
2853 schedule_timeout_uninterruptible(*timeout);
2854 rpc_clnt_sigunmask(clnt, &oldset);
2855 *timeout <<= 1; 2842 *timeout <<= 1;
2856 return res; 2843 return res;
2857} 2844}
@@ -3085,7 +3072,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4
3085static unsigned long 3072static unsigned long
3086nfs4_set_lock_task_retry(unsigned long timeout) 3073nfs4_set_lock_task_retry(unsigned long timeout)
3087{ 3074{
3088 schedule_timeout_interruptible(timeout); 3075 schedule_timeout_killable(timeout);
3089 timeout <<= 1; 3076 timeout <<= 1;
3090 if (timeout > NFS4_LOCK_MAXTIMEOUT) 3077 if (timeout > NFS4_LOCK_MAXTIMEOUT)
3091 return NFS4_LOCK_MAXTIMEOUT; 3078 return NFS4_LOCK_MAXTIMEOUT;
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index 4b0334590ee5..531379d36823 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -228,10 +228,7 @@ static int __init root_nfs_parse(char *name, char *buf)
228 nfs_data.flags &= ~NFS_MOUNT_SOFT; 228 nfs_data.flags &= ~NFS_MOUNT_SOFT;
229 break; 229 break;
230 case Opt_intr: 230 case Opt_intr:
231 nfs_data.flags |= NFS_MOUNT_INTR;
232 break;
233 case Opt_nointr: 231 case Opt_nointr:
234 nfs_data.flags &= ~NFS_MOUNT_INTR;
235 break; 232 break;
236 case Opt_posix: 233 case Opt_posix:
237 nfs_data.flags |= NFS_MOUNT_POSIX; 234 nfs_data.flags |= NFS_MOUNT_POSIX;
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 345bb9b4765b..2dff469f04fe 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -67,7 +67,7 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
67 if (req != NULL) 67 if (req != NULL)
68 break; 68 break;
69 69
70 if (signalled() && (server->flags & NFS_MOUNT_INTR)) 70 if (fatal_signal_pending(current))
71 return ERR_PTR(-ERESTARTSYS); 71 return ERR_PTR(-ERESTARTSYS);
72 yield(); 72 yield();
73 } 73 }
@@ -175,11 +175,11 @@ void nfs_release_request(struct nfs_page *req)
175 kref_put(&req->wb_kref, nfs_free_request); 175 kref_put(&req->wb_kref, nfs_free_request);
176} 176}
177 177
178static int nfs_wait_bit_interruptible(void *word) 178static int nfs_wait_bit_killable(void *word)
179{ 179{
180 int ret = 0; 180 int ret = 0;
181 181
182 if (signal_pending(current)) 182 if (fatal_signal_pending(current))
183 ret = -ERESTARTSYS; 183 ret = -ERESTARTSYS;
184 else 184 else
185 schedule(); 185 schedule();
@@ -190,26 +190,18 @@ static int nfs_wait_bit_interruptible(void *word)
190 * nfs_wait_on_request - Wait for a request to complete. 190 * nfs_wait_on_request - Wait for a request to complete.
191 * @req: request to wait upon. 191 * @req: request to wait upon.
192 * 192 *
193 * Interruptible by signals only if mounted with intr flag. 193 * Interruptible by fatal signals only.
194 * The user is responsible for holding a count on the request. 194 * The user is responsible for holding a count on the request.
195 */ 195 */
196int 196int
197nfs_wait_on_request(struct nfs_page *req) 197nfs_wait_on_request(struct nfs_page *req)
198{ 198{
199 struct rpc_clnt *clnt = NFS_CLIENT(req->wb_context->path.dentry->d_inode);
200 sigset_t oldmask;
201 int ret = 0; 199 int ret = 0;
202 200
203 if (!test_bit(PG_BUSY, &req->wb_flags)) 201 if (!test_bit(PG_BUSY, &req->wb_flags))
204 goto out; 202 goto out;
205 /*
206 * Note: the call to rpc_clnt_sigmask() suffices to ensure that we
207 * are not interrupted if intr flag is not set
208 */
209 rpc_clnt_sigmask(clnt, &oldmask);
210 ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY, 203 ret = out_of_line_wait_on_bit(&req->wb_flags, PG_BUSY,
211 nfs_wait_bit_interruptible, TASK_INTERRUPTIBLE); 204 nfs_wait_bit_killable, TASK_KILLABLE);
212 rpc_clnt_sigunmask(clnt, &oldmask);
213out: 205out:
214 return ret; 206 return ret;
215} 207}
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 4587a86adaac..3dcaa6a73261 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -212,12 +212,7 @@ nfs_async_read_error(struct list_head *head)
212 */ 212 */
213static void nfs_execute_read(struct nfs_read_data *data) 213static void nfs_execute_read(struct nfs_read_data *data)
214{ 214{
215 struct rpc_clnt *clnt = NFS_CLIENT(data->inode);
216 sigset_t oldset;
217
218 rpc_clnt_sigmask(clnt, &oldset);
219 rpc_execute(&data->task); 215 rpc_execute(&data->task);
220 rpc_clnt_sigunmask(clnt, &oldset);
221} 216}
222 217
223/* 218/*
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2426e713b77f..5b6339f70a4c 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -424,7 +424,6 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
424 const char *nostr; 424 const char *nostr;
425 } nfs_info[] = { 425 } nfs_info[] = {
426 { NFS_MOUNT_SOFT, ",soft", ",hard" }, 426 { NFS_MOUNT_SOFT, ",soft", ",hard" },
427 { NFS_MOUNT_INTR, ",intr", ",nointr" },
428 { NFS_MOUNT_NOCTO, ",nocto", "" }, 427 { NFS_MOUNT_NOCTO, ",nocto", "" },
429 { NFS_MOUNT_NOAC, ",noac", "" }, 428 { NFS_MOUNT_NOAC, ",noac", "" },
430 { NFS_MOUNT_NONLM, ",nolock", "" }, 429 { NFS_MOUNT_NONLM, ",nolock", "" },
@@ -624,10 +623,7 @@ static int nfs_parse_mount_options(char *raw,
624 mnt->flags &= ~NFS_MOUNT_SOFT; 623 mnt->flags &= ~NFS_MOUNT_SOFT;
625 break; 624 break;
626 case Opt_intr: 625 case Opt_intr:
627 mnt->flags |= NFS_MOUNT_INTR;
628 break;
629 case Opt_nointr: 626 case Opt_nointr:
630 mnt->flags &= ~NFS_MOUNT_INTR;
631 break; 627 break;
632 case Opt_posix: 628 case Opt_posix:
633 mnt->flags |= NFS_MOUNT_POSIX; 629 mnt->flags |= NFS_MOUNT_POSIX;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 51cc1bd6a116..60e3e870ada4 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -490,7 +490,7 @@ int nfs_reschedule_unstable_write(struct nfs_page *req)
490/* 490/*
491 * Wait for a request to complete. 491 * Wait for a request to complete.
492 * 492 *
493 * Interruptible by signals only if mounted with intr flag. 493 * Interruptible by fatal signals only.
494 */ 494 */
495static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, unsigned int npages) 495static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, unsigned int npages)
496{ 496{
@@ -816,12 +816,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
816 816
817static void nfs_execute_write(struct nfs_write_data *data) 817static void nfs_execute_write(struct nfs_write_data *data)
818{ 818{
819 struct rpc_clnt *clnt = NFS_CLIENT(data->inode);
820 sigset_t oldset;
821
822 rpc_clnt_sigmask(clnt, &oldset);
823 rpc_execute(&data->task); 819 rpc_execute(&data->task);
824 rpc_clnt_sigunmask(clnt, &oldset);
825} 820}
826 821
827/* 822/*
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2d15d4aac094..2814bd40edf6 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -516,14 +516,7 @@ extern void * nfs_root_data(void);
516 516
517#define nfs_wait_event(clnt, wq, condition) \ 517#define nfs_wait_event(clnt, wq, condition) \
518({ \ 518({ \
519 int __retval = 0; \ 519 int __retval = wait_event_killable(wq, condition); \
520 if (clnt->cl_intr) { \
521 sigset_t oldmask; \
522 rpc_clnt_sigmask(clnt, &oldmask); \
523 __retval = wait_event_interruptible(wq, condition); \
524 rpc_clnt_sigunmask(clnt, &oldmask); \
525 } else \
526 wait_event(wq, condition); \
527 __retval; \ 520 __retval; \
528}) 521})
529 522
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index a3ade89a64d2..df7c6b7a7ebb 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -48,7 +48,7 @@ struct nfs_mount_data {
48/* bits in the flags field */ 48/* bits in the flags field */
49 49
50#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 50#define NFS_MOUNT_SOFT 0x0001 /* 1 */
51#define NFS_MOUNT_INTR 0x0002 /* 1 */ 51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */
52#define NFS_MOUNT_SECURE 0x0004 /* 1 */ 52#define NFS_MOUNT_SECURE 0x0004 /* 1 */
53#define NFS_MOUNT_POSIX 0x0008 /* 1 */ 53#define NFS_MOUNT_POSIX 0x0008 /* 1 */
54#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ 54#define NFS_MOUNT_NOCTO 0x0010 /* 1 */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index d9d5c5ad826c..01879365f4ec 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -41,7 +41,6 @@ struct rpc_clnt {
41 struct rpc_iostats * cl_metrics; /* per-client statistics */ 41 struct rpc_iostats * cl_metrics; /* per-client statistics */
42 42
43 unsigned int cl_softrtry : 1,/* soft timeouts */ 43 unsigned int cl_softrtry : 1,/* soft timeouts */
44 cl_intr : 1,/* interruptible */
45 cl_discrtry : 1,/* disconnect before retry */ 44 cl_discrtry : 1,/* disconnect before retry */
46 cl_autobind : 1;/* use getport() */ 45 cl_autobind : 1;/* use getport() */
47 46
@@ -109,7 +108,6 @@ struct rpc_create_args {
109 108
110/* Values for "flags" field */ 109/* Values for "flags" field */
111#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0) 110#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
112#define RPC_CLNT_CREATE_INTR (1UL << 1)
113#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2) 111#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3) 112#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3)
115#define RPC_CLNT_CREATE_NOPING (1UL << 4) 113#define RPC_CLNT_CREATE_NOPING (1UL << 4)
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8ea077db0099..19160e63d6ad 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -128,7 +128,6 @@ struct rpc_call_ops {
128#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ 128#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
129#define RPC_TASK_KILLED 0x0100 /* task was killed */ 129#define RPC_TASK_KILLED 0x0100 /* task was killed */
130#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ 130#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */
131#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */
132 131
133#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 132#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
134#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 133#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
@@ -136,7 +135,6 @@ struct rpc_call_ops {
136#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 135#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
137#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) 136#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
138#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 137#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
139#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)
140 138
141#define RPC_TASK_RUNNING 0 139#define RPC_TASK_RUNNING 0
142#define RPC_TASK_QUEUED 1 140#define RPC_TASK_QUEUED 1
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
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index a05493aedb68..c35b6e7fc680 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -172,8 +172,7 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
172 .program = &rpcb_program, 172 .program = &rpcb_program,
173 .version = version, 173 .version = version,
174 .authflavor = RPC_AUTH_UNIX, 174 .authflavor = RPC_AUTH_UNIX,
175 .flags = (RPC_CLNT_CREATE_NOPING | 175 .flags = RPC_CLNT_CREATE_NOPING,
176 RPC_CLNT_CREATE_INTR),
177 }; 176 };
178 177
179 switch (srvaddr->sa_family) { 178 switch (srvaddr->sa_family) {
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index c98873f39aec..4b22910b4461 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}
246EXPORT_SYMBOL(rpc_init_wait_queue); 246EXPORT_SYMBOL(rpc_init_wait_queue);
247 247
248static int rpc_wait_bit_interruptible(void *word) 248static 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)
299int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *)) 299int __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}
306EXPORT_SYMBOL(__rpc_wait_for_completion_task); 306EXPORT_SYMBOL(__rpc_wait_for_completion_task);
307 307
@@ -690,10 +690,9 @@ static void __rpc_execute(struct rpc_task *task)
690 690
691 /* sync task: sleep here */ 691 /* sync task: sleep here */
692 dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); 692 dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid);
693 /* Note: Caller should be using rpc_clnt_sigmask() */
694 status = out_of_line_wait_on_bit(&task->tk_runstate, 693 status = out_of_line_wait_on_bit(&task->tk_runstate,
695 RPC_TASK_QUEUED, rpc_wait_bit_interruptible, 694 RPC_TASK_QUEUED, rpc_wait_bit_killable,
696 TASK_INTERRUPTIBLE); 695 TASK_KILLABLE);
697 if (status == -ERESTARTSYS) { 696 if (status == -ERESTARTSYS) {
698 /* 697 /*
699 * When a sync task receives a signal, it exits with 698 * When a sync task receives a signal, it exits with
@@ -837,8 +836,6 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons
837 kref_get(&clnt->cl_kref); 836 kref_get(&clnt->cl_kref);
838 if (clnt->cl_softrtry) 837 if (clnt->cl_softrtry)
839 task->tk_flags |= RPC_TASK_SOFT; 838 task->tk_flags |= RPC_TASK_SOFT;
840 if (!clnt->cl_intr)
841 task->tk_flags |= RPC_TASK_NOINTR;
842 } 839 }
843 840
844 BUG_ON(task->tk_ops == NULL); 841 BUG_ON(task->tk_ops == NULL);
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index 33d89e842c85..1fd3aa81938a 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -38,8 +38,6 @@ EXPORT_SYMBOL(rpc_killall_tasks);
38EXPORT_SYMBOL(rpc_call_sync); 38EXPORT_SYMBOL(rpc_call_sync);
39EXPORT_SYMBOL(rpc_call_async); 39EXPORT_SYMBOL(rpc_call_async);
40EXPORT_SYMBOL(rpc_call_setup); 40EXPORT_SYMBOL(rpc_call_setup);
41EXPORT_SYMBOL(rpc_clnt_sigmask);
42EXPORT_SYMBOL(rpc_clnt_sigunmask);
43EXPORT_SYMBOL(rpc_delay); 41EXPORT_SYMBOL(rpc_delay);
44EXPORT_SYMBOL(rpc_restart_call); 42EXPORT_SYMBOL(rpc_restart_call);
45EXPORT_SYMBOL(rpc_setbufsize); 43EXPORT_SYMBOL(rpc_setbufsize);