|
@@ -557,7 +557,7 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
|
|
|
|
|
|
static void forget_original_parent(struct task_struct *father)
|
|
static void forget_original_parent(struct task_struct *father)
|
|
{
|
|
{
|
|
- struct task_struct *p, *n, *reaper;
|
|
|
|
|
|
+ struct task_struct *p, *t, *n, *reaper;
|
|
LIST_HEAD(dead_children);
|
|
LIST_HEAD(dead_children);
|
|
|
|
|
|
write_lock_irq(&tasklist_lock);
|
|
write_lock_irq(&tasklist_lock);
|
|
@@ -569,18 +569,15 @@ static void forget_original_parent(struct task_struct *father)
|
|
reaper = find_new_reaper(father);
|
|
reaper = find_new_reaper(father);
|
|
|
|
|
|
list_for_each_entry_safe(p, n, &father->children, sibling) {
|
|
list_for_each_entry_safe(p, n, &father->children, sibling) {
|
|
- struct task_struct *t = p;
|
|
|
|
-
|
|
|
|
- do {
|
|
|
|
|
|
+ for_each_thread(p, t) {
|
|
t->real_parent = reaper;
|
|
t->real_parent = reaper;
|
|
- if (t->parent == father) {
|
|
|
|
- BUG_ON(t->ptrace);
|
|
|
|
|
|
+ BUG_ON((!t->ptrace) != (t->parent == father));
|
|
|
|
+ if (likely(!t->ptrace))
|
|
t->parent = t->real_parent;
|
|
t->parent = t->real_parent;
|
|
- }
|
|
|
|
if (t->pdeath_signal)
|
|
if (t->pdeath_signal)
|
|
group_send_sig_info(t->pdeath_signal,
|
|
group_send_sig_info(t->pdeath_signal,
|
|
SEND_SIG_NOINFO, t);
|
|
SEND_SIG_NOINFO, t);
|
|
- } while_each_thread(p, t);
|
|
|
|
|
|
+ }
|
|
reparent_leader(father, p, &dead_children);
|
|
reparent_leader(father, p, &dead_children);
|
|
}
|
|
}
|
|
write_unlock_irq(&tasklist_lock);
|
|
write_unlock_irq(&tasklist_lock);
|