From acedf86915912eb4da0c900a997e357b104758aa Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Tue, 28 Mar 2006 16:10:59 -0800 Subject: [PATCH] --- yaml --- r: 24541 b: refs/heads/master c: 1434261c07bcebd5ef8b8a18f919fdee533b84e0 h: refs/heads/master i: 24539: bcff792c27a424e8045b24f92a9eeead2fec02a8 v: v3 --- [refs] | 2 +- trunk/fs/exec.c | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 99442d00702c..4e9fba7ef205 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fef23e7fbb11a0a78cd61935f7056bc2b237995a +refs/heads/master: 1434261c07bcebd5ef8b8a18f919fdee533b84e0 diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index d0ecea0781f7..dd194923c52c 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -616,6 +616,15 @@ static int de_thread(struct task_struct *tsk) kmem_cache_free(sighand_cachep, newsighand); return -EAGAIN; } + + /* + * child_reaper ignores SIGKILL, change it now. + * Reparenting needs write_lock on tasklist_lock, + * so it is safe to do it under read_lock. + */ + if (unlikely(current->group_leader == child_reaper)) + child_reaper = current; + zap_other_threads(current); read_unlock(&tasklist_lock); @@ -660,23 +669,12 @@ static int de_thread(struct task_struct *tsk) struct dentry *proc_dentry1, *proc_dentry2; unsigned long ptrace; - leader = current->group_leader; - /* - * If our leader is the child_reaper become - * the child_reaper and resend SIGKILL signal. - */ - if (unlikely(leader == child_reaper)) { - write_lock(&tasklist_lock); - child_reaper = current; - zap_other_threads(current); - write_unlock(&tasklist_lock); - } - /* * Wait for the thread group leader to be a zombie. * It should already be zombie at this point, most * of the time. */ + leader = current->group_leader; while (leader->exit_state != EXIT_ZOMBIE) yield();