]> git.baikalelectronics.ru Git - kernel.git/commit
PM / Freezer: Reimplement wait_event_freezekillable using freezer_do_not_count/freeze...
authorOleg Nesterov <oleg@redhat.com>
Thu, 3 Nov 2011 23:07:49 +0000 (16:07 -0700)
committerRafael J. Wysocki <rjw@sisk.pl>
Fri, 4 Nov 2011 21:28:15 +0000 (22:28 +0100)
commit7a0f754a35532aa3eff2bdd3e21a46dd31581126
treee8af20e67b4d08b1b819b7917104468df85210f8
parent2071278fa66445e58b67dbc1c40fcb705cf69e50
PM / Freezer: Reimplement wait_event_freezekillable using freezer_do_not_count/freezer_count

Commit 23dc7ac20f "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 b05a234304 "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 23dc7ac20f, 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>
include/linux/freezer.h