aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/inode.c3
-rw-r--r--fs/nfs/nfs3proc.c3
-rw-r--r--fs/nfs/nfs4proc.c5
-rw-r--r--fs/nfs/proc.c3
-rw-r--r--include/linux/freezer.h28
-rw-r--r--net/sunrpc/sched.c3
6 files changed, 39 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 50a15fa8cf9..bf3a57bbbfc 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -38,6 +38,7 @@
38#include <linux/nfs_xdr.h> 38#include <linux/nfs_xdr.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/compat.h> 40#include <linux/compat.h>
41#include <linux/freezer.h>
41 42
42#include <asm/system.h> 43#include <asm/system.h>
43#include <asm/uaccess.h> 44#include <asm/uaccess.h>
@@ -77,7 +78,7 @@ int nfs_wait_bit_killable(void *word)
77{ 78{
78 if (fatal_signal_pending(current)) 79 if (fatal_signal_pending(current))
79 return -ERESTARTSYS; 80 return -ERESTARTSYS;
80 schedule(); 81 freezable_schedule();
81 return 0; 82 return 0;
82} 83}
83 84
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index d4bc9ed9174..91943953a37 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -17,6 +17,7 @@
17#include <linux/nfs_page.h> 17#include <linux/nfs_page.h>
18#include <linux/lockd/bind.h> 18#include <linux/lockd/bind.h>
19#include <linux/nfs_mount.h> 19#include <linux/nfs_mount.h>
20#include <linux/freezer.h>
20 21
21#include "iostat.h" 22#include "iostat.h"
22#include "internal.h" 23#include "internal.h"
@@ -32,7 +33,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
32 res = rpc_call_sync(clnt, msg, flags); 33 res = rpc_call_sync(clnt, msg, flags);
33 if (res != -EJUKEBOX && res != -EKEYEXPIRED) 34 if (res != -EJUKEBOX && res != -EKEYEXPIRED)
34 break; 35 break;
35 schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME); 36 freezable_schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME);
36 res = -ERESTARTSYS; 37 res = -ERESTARTSYS;
37 } while (!fatal_signal_pending(current)); 38 } while (!fatal_signal_pending(current));
38 return res; 39 return res;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index be2bbac1381..b28bb19b04f 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -53,6 +53,7 @@
53#include <linux/sunrpc/bc_xprt.h> 53#include <linux/sunrpc/bc_xprt.h>
54#include <linux/xattr.h> 54#include <linux/xattr.h>
55#include <linux/utsname.h> 55#include <linux/utsname.h>
56#include <linux/freezer.h>
56 57
57#include "nfs4_fs.h" 58#include "nfs4_fs.h"
58#include "delegation.h" 59#include "delegation.h"
@@ -241,7 +242,7 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
241 *timeout = NFS4_POLL_RETRY_MIN; 242 *timeout = NFS4_POLL_RETRY_MIN;
242 if (*timeout > NFS4_POLL_RETRY_MAX) 243 if (*timeout > NFS4_POLL_RETRY_MAX)
243 *timeout = NFS4_POLL_RETRY_MAX; 244 *timeout = NFS4_POLL_RETRY_MAX;
244 schedule_timeout_killable(*timeout); 245 freezable_schedule_timeout_killable(*timeout);
245 if (fatal_signal_pending(current)) 246 if (fatal_signal_pending(current))
246 res = -ERESTARTSYS; 247 res = -ERESTARTSYS;
247 *timeout <<= 1; 248 *timeout <<= 1;
@@ -3950,7 +3951,7 @@ int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4
3950static unsigned long 3951static unsigned long
3951nfs4_set_lock_task_retry(unsigned long timeout) 3952nfs4_set_lock_task_retry(unsigned long timeout)
3952{ 3953{
3953 schedule_timeout_killable(timeout); 3954 freezable_schedule_timeout_killable(timeout);
3954 timeout <<= 1; 3955 timeout <<= 1;
3955 if (timeout > NFS4_LOCK_MAXTIMEOUT) 3956 if (timeout > NFS4_LOCK_MAXTIMEOUT)
3956 return NFS4_LOCK_MAXTIMEOUT; 3957 return NFS4_LOCK_MAXTIMEOUT;
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index f48125da198..0c672588fe5 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -41,6 +41,7 @@
41#include <linux/nfs_fs.h> 41#include <linux/nfs_fs.h>
42#include <linux/nfs_page.h> 42#include <linux/nfs_page.h>
43#include <linux/lockd/bind.h> 43#include <linux/lockd/bind.h>
44#include <linux/freezer.h>
44#include "internal.h" 45#include "internal.h"
45 46
46#define NFSDBG_FACILITY NFSDBG_PROC 47#define NFSDBG_FACILITY NFSDBG_PROC
@@ -59,7 +60,7 @@ nfs_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
59 res = rpc_call_sync(clnt, msg, flags); 60 res = rpc_call_sync(clnt, msg, flags);
60 if (res != -EKEYEXPIRED) 61 if (res != -EKEYEXPIRED)
61 break; 62 break;
62 schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME); 63 freezable_schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME);
63 res = -ERESTARTSYS; 64 res = -ERESTARTSYS;
64 } while (!fatal_signal_pending(current)); 65 } while (!fatal_signal_pending(current));
65 return res; 66 return res;
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index c1ee2833655..30f06c22046 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -105,6 +105,29 @@ static inline int freezer_should_skip(struct task_struct *p)
105} 105}
106 106
107/* 107/*
108 * These macros are intended to be used whenever you want allow a task that's
109 * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
110 * that neither return any clear indication of whether a freeze event happened
111 * while in this function.
112 */
113
114/* Like schedule(), but should not block the freezer. */
115#define freezable_schedule() \
116({ \
117 freezer_do_not_count(); \
118 schedule(); \
119 freezer_count(); \
120})
121
122/* Like schedule_timeout_killable(), but should not block the freezer. */
123#define freezable_schedule_timeout_killable(timeout) \
124({ \
125 freezer_do_not_count(); \
126 schedule_timeout_killable(timeout); \
127 freezer_count(); \
128})
129
130/*
108 * Freezer-friendly wrappers around wait_event_interruptible(), 131 * Freezer-friendly wrappers around wait_event_interruptible(),
109 * wait_event_killable() and wait_event_interruptible_timeout(), originally 132 * wait_event_killable() and wait_event_interruptible_timeout(), originally
110 * defined in <linux/wait.h> 133 * defined in <linux/wait.h>
@@ -163,6 +186,11 @@ static inline void freezer_count(void) {}
163static inline int freezer_should_skip(struct task_struct *p) { return 0; } 186static inline int freezer_should_skip(struct task_struct *p) { return 0; }
164static inline void set_freezable(void) {} 187static inline void set_freezable(void) {}
165 188
189#define freezable_schedule() schedule()
190
191#define freezable_schedule_timeout_killable(timeout) \
192 schedule_timeout_killable(timeout)
193
166#define wait_event_freezable(wq, condition) \ 194#define wait_event_freezable(wq, condition) \
167 wait_event_interruptible(wq, condition) 195 wait_event_interruptible(wq, condition)
168 196
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index d12ffa54581..5317b9341b5 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -18,6 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/freezer.h>
21 22
22#include <linux/sunrpc/clnt.h> 23#include <linux/sunrpc/clnt.h>
23 24
@@ -231,7 +232,7 @@ static int rpc_wait_bit_killable(void *word)
231{ 232{
232 if (fatal_signal_pending(current)) 233 if (fatal_signal_pending(current))
233 return -ERESTARTSYS; 234 return -ERESTARTSYS;
234 schedule(); 235 freezable_schedule();
235 return 0; 236 return 0;
236} 237}
237 238