Skip to content

Commit

Permalink
[PATCH] cpu-hotplug: release `workqueue_mutex' properly on CPU hot-re…
Browse files Browse the repository at this point in the history
…move

_cpu_down() acquires `workqueue_mutex' on its process, but doen't release it
if __cpu_disable() fails.

Signed-off-by: Satoru Takeuchi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Satoru Takeuchi authored and Linus Torvalds committed Oct 28, 2006
1 parent bb1d860 commit 8fa1d7d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 8fa1d7d

Please sign in to comment.