X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=kernel%2Fpid_namespace.c;h=b3c7fd5542500ab13940814211692bbe3b7ef8d3;hb=d4e3ab384b2343c7074f713ac330f839c38c52ee;hp=16b20e38c4a1e26e64db477f76bbbfcf1787b75b;hpb=0b3e9f3f21c42d064f5f4088df4088e3d55755eb;p=~andy%2Flinux diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 16b20e38c4a..b3c7fd55425 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -184,11 +184,31 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) } read_unlock(&tasklist_lock); + /* Firstly reap the EXIT_ZOMBIE children we may have. */ do { clear_thread_flag(TIF_SIGPENDING); rc = sys_wait4(-1, NULL, __WALL, NULL); } while (rc != -ECHILD); + /* + * sys_wait4() above can't reap the TASK_DEAD children. + * Make sure they all go away, see __unhash_process(). + */ + for (;;) { + bool need_wait = false; + + read_lock(&tasklist_lock); + if (!list_empty(¤t->children)) { + __set_current_state(TASK_UNINTERRUPTIBLE); + need_wait = true; + } + read_unlock(&tasklist_lock); + + if (!need_wait) + break; + schedule(); + } + if (pid_ns->reboot) current->signal->group_exit_code = pid_ns->reboot;