summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-12-10 18:55:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:17 -0500
commit175aed3f8d38b87d3287bb765c794205f2b511de (patch)
tree81365f68bb26d9c14cc6059990ca0deb6b6af941 /kernel/exit.c
parent3750ef979cfa1296630aa9f23e265c1bd721498a (diff)
exit: reparent: document the ->has_child_subreaper checks
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 <oleg@redhat.com> Cc: Aaron Tomlin <atomlin@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Kay Sievers <kay@vrfy.org> Cc: Lennart Poettering <lennart@poettering.net> Cc: Sterling Alexander <stalexan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index a4204aaba8a2..576949ce5665 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -495,18 +495,16 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
495 495
496 if (father->signal->has_child_subreaper) { 496 if (father->signal->has_child_subreaper) {
497 struct task_struct *reaper; 497 struct task_struct *reaper;
498
499 /* 498 /*
500 * Find the first ancestor marked as child_subreaper. 499 * Find the first ->is_child_subreaper ancestor in our pid_ns.
501 * Note that the code below checks same_thread_group(reaper, 500 * We start from father to ensure we can not look into another
502 * pid_ns->child_reaper). This is what we need to DTRT in a 501 * namespace, this is safe because all its threads are dead.
503 * PID namespace. However we still need the check above, see
504 * http://marc.info/?l=linux-kernel&m=131385460420380
505 */ 502 */
506 for (reaper = father; 503 for (reaper = father;
507 reaper != &init_task; 504 !same_thread_group(reaper, pid_ns->child_reaper);
508 reaper = reaper->real_parent) { 505 reaper = reaper->real_parent) {
509 if (same_thread_group(reaper, pid_ns->child_reaper)) 506 /* call_usermodehelper() descendants need this check */
507 if (reaper == &init_task)
510 break; 508 break;
511 if (!reaper->signal->is_child_subreaper) 509 if (!reaper->signal->is_child_subreaper)
512 continue; 510 continue;