aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/freezer.h
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2011-11-03 19:07:49 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-11-04 17:28:15 -0400
commit6f35c4abd7f0294166a5e0ab0401fe7949b33034 (patch)
treee8af20e67b4d08b1b819b7917104468df85210f8 /include/linux/freezer.h
parentb2c0a863e14676fa5760c6d828fd373288e2f64a (diff)
PM / Freezer: Reimplement wait_event_freezekillable using freezer_do_not_count/freezer_count
Commit 27920651fe "PM / Freezer: Make fake_signal_wake_up() wake TASK_KILLABLE tasks too" updated fake_signal_wake_up() used by freezer to wake up KILLABLE tasks. Sending unsolicited wakeups to tasks in killable sleep is dangerous as there are code paths which depend on tasks not waking up spuriously from KILLABLE sleep. For example. sys_read() or page can sleep in TASK_KILLABLE assuming that wait/down/whatever _killable can only fail if we can not return to the usermode. TASK_TRACED is another obvious example. The offending commit was to resolve freezer hang during system PM operations caused by KILLABLE sleeps in network filesystems. wait_event_freezekillable(), which depends on the spurious KILLABLE wakeup, was added by f06ac72e92 "cifs, freezer: add wait_event_freezekillable and have cifs use it" to be used to implement killable & freezable sleeps in network filesystems. To prepare for reverting of 27920651fe, this patch reimplements wait_event_freezekillable() using freezer_do_not_count/freezer_count() so that it doesn't depend on the spurious KILLABLE wakeup. This isn't very nice but should do for now. [tj: Refreshed patch to apply to linus/master and updated commit description on Rafael's request.] Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r--include/linux/freezer.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index a49b52934c55..a5386e3ee756 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -143,14 +143,9 @@ static inline void set_freezable_with_signal(void)
143#define wait_event_freezekillable(wq, condition) \ 143#define wait_event_freezekillable(wq, condition) \
144({ \ 144({ \
145 int __retval; \ 145 int __retval; \
146 do { \ 146 freezer_do_not_count(); \
147 __retval = wait_event_killable(wq, \ 147 __retval = wait_event_killable(wq, (condition)); \
148 (condition) || freezing(current)); \ 148 freezer_count(); \
149 if (__retval && !freezing(current)) \
150 break; \
151 else if (!(condition)) \
152 __retval = -ERESTARTSYS; \
153 } while (try_to_freeze()); \
154 __retval; \ 149 __retval; \
155}) 150})
156 151