mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] reparent_thread: don't call kill_orphaned_pgrp() if task_detached()
@ 2009-01-29  8:05 Oleg Nesterov
  2009-02-05  2:00 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2009-01-29  8:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Eric W. Biederman, Roland McGrath, linux-kernel

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.

Move the task_detached() check up and simplify the code, this is also
right from the "common sense" pov: we should do nothing with the detached
childs, except move them to the new parent's ->children list.

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

--- 6.29-rc3/kernel/exit.c~5_SIMPLIFY_REPARENT_THREAD	2009-01-29 04:09:40.000000000 +0100
+++ 6.29-rc3/kernel/exit.c	2009-01-29 06:21:51.000000000 +0100
@@ -812,6 +812,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.
 	 */
@@ -819,15 +821,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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/4] reparent_thread: don't call kill_orphaned_pgrp() if task_detached()
  2009-01-29  8:05 [PATCH 1/4] reparent_thread: don't call kill_orphaned_pgrp() if task_detached() Oleg Nesterov
@ 2009-02-05  2:00 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2009-02-05  2:00 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, Eric W. Biederman, linux-kernel

Acked-by: Roland McGrath <roland@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-05  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-29  8:05 [PATCH 1/4] reparent_thread: don't call kill_orphaned_pgrp() if task_detached() Oleg Nesterov
2009-02-05  2:00 ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®