lkml.org 
[lkml]   [2008]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] processes: reparent_thread: don't call kill_orphaned_pgrp() if task_detached()
Needs an ack from someone who understands orphaned groups.

If task_detached(p) == T, then either

a) p is not the main thread, we will find the group leader
on the ->children list.
or
b) p is the group leader but its ->exit_state = EXIT_DEAD.
This can only happen when the last sub-thread has died,
but in that case that thread has already called
kill_orphaned_pgrp() from exit_notify().

In both cases kill_orphaned_pgrp() looks bogus.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- K-28/kernel/exit.c~1_IGNORE_DETACHED 2008-11-17 02:02:12.000000000 +0100
+++ K-28/kernel/exit.c 2008-11-20 20:21:02.000000000 +0100
@@ -816,6 +816,8 @@ static void reparent_thread(struct task_

list_move_tail(&p->sibling, &p->real_parent->children);

+ if (task_detached(p))
+ return;
/* If this is a threaded reparent there is no need to
* notify anyone anything has happened.
*/
@@ -823,15 +825,13 @@ static void reparent_thread(struct task_
return;

/* We don't want people slaying init. */
- if (!task_detached(p))
- p->exit_signal = SIGCHLD;
+ p->exit_signal = SIGCHLD;

/* If we'd notified the old parent about this child's death,
* also notify the new parent.
*/
if (!ptrace_reparented(p) &&
- p->exit_state == EXIT_ZOMBIE &&
- !task_detached(p) && thread_group_empty(p))
+ p->exit_state == EXIT_ZOMBIE && thread_group_empty(p))
do_notify_parent(p, p->exit_signal);

kill_orphaned_pgrp(p, father);


\
 
 \ /
  Last update: 2008-11-20 20:31    [W:0.126 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site