pidns: Wait in zap_pid_ns_processes until pid_ns->nr_hashed == 1
Looking at pid_ns->nr_hashed is a bit simpler and it works for disjoint process trees that an unshare or a join of a pid_namespace may create. Acked-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
@ -217,22 +217,15 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
|
||||
|
||||
/*
|
||||
* sys_wait4() above can't reap the TASK_DEAD children.
|
||||
* Make sure they all go away, see __unhash_process().
|
||||
* Make sure they all go away, see free_pid().
|
||||
*/
|
||||
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)
|
||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
||||
if (pid_ns->nr_hashed == 1)
|
||||
break;
|
||||
schedule();
|
||||
}
|
||||
__set_current_state(TASK_RUNNING);
|
||||
|
||||
if (pid_ns->reboot)
|
||||
current->signal->group_exit_code = pid_ns->reboot;
|
||||
|
Reference in New Issue
Block a user