summaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorSatoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>2006-10-28 10:38:57 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-28 11:30:55 -0700
commit8fa1d7d3b2c51594c0f3aa151983dd51f605e07d (patch)
tree8fbc0037f98d1cc3201ca1a816b42ad87930e2db /kernel/cpu.c
parentbb1d860551c4307b1a7ee9a21b120319075e987e (diff)
[PATCH] cpu-hotplug: release `workqueue_mutex' properly on CPU hot-remove
_cpu_down() acquires `workqueue_mutex' on its process, but doen't release it if __cpu_disable() fails. Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 27dd3ee4709..663c920b223 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -150,18 +150,18 @@ static int _cpu_down(unsigned int cpu)
p = __stop_machine_run(take_cpu_down, NULL, cpu);
mutex_unlock(&cpu_bitmask_lock);
- if (IS_ERR(p)) {
+ if (IS_ERR(p) || cpu_online(cpu)) {
/* CPU didn't die: tell everyone. Can't complain. */
if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
(void *)(long)cpu) == NOTIFY_BAD)
BUG();
- err = PTR_ERR(p);
- goto out_allowed;
- }
-
- if (cpu_online(cpu))
+ if (IS_ERR(p)) {
+ err = PTR_ERR(p);
+ goto out_allowed;
+ }
goto out_thread;
+ }
/* Wait for it to sleep (leaving idle task). */
while (!idle_cpu(cpu))