History

pid: Handle the exit of a multi-threaded init.

When a multi-threaded init exits and the initial thread is not the last thread to exit the initial thread hangs around as a zombie until the last thread exits. In that case zap_pid_ns_processes needs to wait until there are only 2 hashed pids in the pid namespace not one. v2. Replace thread_pid_vnr(me) == 1 with the test thread_group_leader(me) as suggested by Oleg.

Eric W. Biederman committed 13 years ago

Commit 751c6441 parent 92f28d91 file · +2 −1Browse files

Unified · Split

kernel/pid_namespace.c+2−1
@@ -181,6 +181,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) · 180 unmodified lines
181181 int nr;
182182 int rc;
183183 struct task_struct *task, *me = current;
184+ int init_pids = thread_group_leader(me) ? 1 : 2;
184185
185186 /* Don't allow any more processes into the pid namespace */
186187 disable_pid_allocation(pid_ns);
@@ -230,7 +231,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) · 43 unmodified lines
230231 */
231232 for (;;) {
232233 set_current_state(TASK_UNINTERRUPTIBLE);
233− if (pid_ns->nr_hashed == 1)
234+ if (pid_ns->nr_hashed == init_pids)
234235 break;
235236 schedule();
236237 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t