Skip to content

Commit

Permalink
exit: reparent: document the ->has_child_subreaper checks
Browse files Browse the repository at this point in the history
Swap the "init_task" and same_thread_group() checks.  This way it is more
simple to document these checks and we can remove the link to the previous
discussion on lkml.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Aaron Tomlin <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: Lennart Poettering <[email protected]>
Cc: Sterling Alexander <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Dec 11, 2014
1 parent 3750ef9 commit 175aed3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,16 @@ static struct task_struct *find_new_reaper(struct task_struct *father)

if (father->signal->has_child_subreaper) {
struct task_struct *reaper;

/*
* Find the first ancestor marked as child_subreaper.
* Note that the code below checks same_thread_group(reaper,
* pid_ns->child_reaper). This is what we need to DTRT in a
* PID namespace. However we still need the check above, see
* http://marc.info/?l=linux-kernel&m=131385460420380
* Find the first ->is_child_subreaper ancestor in our pid_ns.
* We start from father to ensure we can not look into another
* namespace, this is safe because all its threads are dead.
*/
for (reaper = father;
reaper != &init_task;
!same_thread_group(reaper, pid_ns->child_reaper);
reaper = reaper->real_parent) {
if (same_thread_group(reaper, pid_ns->child_reaper))
/* call_usermodehelper() descendants need this check */
if (reaper == &init_task)
break;
if (!reaper->signal->is_child_subreaper)
continue;
Expand Down

0 comments on commit 175aed3

Please sign in to comment.