aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/pid_namespace.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-01 18:03:42 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-11-19 08:59:12 -0500
commitaf4b8a83add95ef40716401395b44a1b579965f4 (patch)
tree2f3f606b7327f74c1c1beb8a75886318c51c838a /kernel/pid_namespace.c
parent5e1182deb81ae8c68494017c4a8a71811659c870 (diff)
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.c15
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)
217 217
218 /* 218 /*
219 * sys_wait4() above can't reap the TASK_DEAD children. 219 * sys_wait4() above can't reap the TASK_DEAD children.
220 * Make sure they all go away, see __unhash_process(). 220 * Make sure they all go away, see free_pid().
221 */ 221 */
222 for (;;) { 222 for (;;) {
223 bool need_wait = false; 223 set_current_state(TASK_UNINTERRUPTIBLE);
224 224 if (pid_ns->nr_hashed == 1)
225 read_lock(&tasklist_lock);
226 if (!list_empty(&current->children)) {
227 __set_current_state(TASK_UNINTERRUPTIBLE);
228 need_wait = true;
229 }
230 read_unlock(&tasklist_lock);
231
232 if (!need_wait)
233 break; 225 break;
234 schedule(); 226 schedule();
235 } 227 }
228 __set_current_state(TASK_RUNNING);
236 229
237 if (pid_ns->reboot) 230 if (pid_ns->reboot)
238 current->signal->group_exit_code = pid_ns->reboot; 231 current->signal->group_exit_code = pid_ns->reboot;