diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-08-01 15:03:42 -0700 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-19 05:59:12 -0800 |
commit | af4b8a83add95ef40716401395b44a1b579965f4 (patch) | |
tree | 2f3f606b7327f74c1c1beb8a75886318c51c838a /kernel/pid_namespace.c | |
parent | 5e1182deb81ae8c68494017c4a8a71811659c870 (diff) | |
download | lwn-af4b8a83add95ef40716401395b44a1b579965f4.tar.gz lwn-af4b8a83add95ef40716401395b44a1b579965f4.zip |
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>
Diffstat (limited to 'kernel/pid_namespace.c')
-rw-r--r-- | kernel/pid_namespace.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 84591cfeefc1..3cc29b830e9e 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -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; |