]> git.baikalelectronics.ru Git - kernel.git/commit
freezer: fix wait_event_freezable/__thaw_task races
authorOleg Nesterov <oleg@redhat.com>
Wed, 23 Nov 2011 17:28:17 +0000 (09:28 -0800)
committerTejun Heo <tj@kernel.org>
Wed, 23 Nov 2011 17:28:17 +0000 (09:28 -0800)
commita3bc7a13460052342980f2637d089f8e31527ab5
tree899a48d29daebb6e2eb9398797304985e5961fc8
parent690a034e10af080d99d7d98d0de373a9b1404467
freezer: fix wait_event_freezable/__thaw_task races

wait_event_freezable() and friends stop the waiting if try_to_freeze()
fails. This is not right, we can race with __thaw_task() and in this
case

- wait_event_freezable() returns the wrong ERESTARTSYS

- wait_event_freezable_timeout() can return the positive
  value while condition == F

Change the code to always check __retval/condition before return.

Note: with or without this patch the timeout logic looks strange,
probably we should recalc timeout if try_to_freeze() returns T.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
include/linux/freezer.h