aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2007-05-06 17:50:40 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:58 -0400
commit433ecb4ab312f873870b67ee374502e84f6dcf92 (patch)
tree6df7459af26ba1f09bfffcf7029a838037bb595a
parente87be1143472d841c1907e6e7ae4862a30e3595c (diff)
fix refrigerator() vs thaw_process() race
refrigerator() can miss a wakeup, "wait event" loop needs a proper memory ordering. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/power/process.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 6d566bf7085c..0eb5c420e8ed 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -47,8 +47,10 @@ void refrigerator(void)
47 recalc_sigpending(); /* We sent fake signal, clean it up */ 47 recalc_sigpending(); /* We sent fake signal, clean it up */
48 spin_unlock_irq(&current->sighand->siglock); 48 spin_unlock_irq(&current->sighand->siglock);
49 49
50 while (frozen(current)) { 50 for (;;) {
51 current->state = TASK_UNINTERRUPTIBLE; 51 set_current_state(TASK_UNINTERRUPTIBLE);
52 if (!frozen(current))
53 break;
52 schedule(); 54 schedule();
53 } 55 }
54 pr_debug("%s left refrigerator\n", current->comm); 56 pr_debug("%s left refrigerator\n", current->comm);