When a dead detached thread has been temporarily zombified because it's
ptraced and its tracer tries to reap it, it deadlocks on SMP. Here's a fix.
Thanks,
Roland
--- linux-2.5/kernel/exit.c 6 Aug 2003 05:30:45 -0000 1.109
+++ linux-2.5/kernel/exit.c 6 Aug 2003 06:04:02 -0000
@@ -898,13 +898,19 @@ static int wait_task_zombie(task_t *p, u
__ptrace_unlink(p);
p->state = TASK_ZOMBIE;
/* If this is a detached thread, this is where it goes away. */
- if (p->exit_signal == -1)
+ if (p->exit_signal == -1) {
+ /* release_task takes the lock itself. */
+ write_unlock_irq(&tasklist_lock);
release_task (p);
- else
+ }
+ else {
do_notify_parent(p, p->exit_signal);
+ write_unlock_irq(&tasklist_lock);
+ }
p = NULL;
}
- write_unlock_irq(&tasklist_lock);
+ else
+ write_unlock_irq(&tasklist_lock);
}
if (p != NULL)
release_task(p);