aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
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 /fs/nfs
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 'fs/nfs')
-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
11 files changed, 19 insertions, 76 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/*