Guenter Roeck <li...@roeck-us.net> writes: > On Thu, May 11, 2017 at 04:25:23PM -0500, Eric W. Biederman wrote: >> Guenter Roeck <li...@roeck-us.net> writes:
>> > As an add-on to my previous mail: I added a function to count >> > the number of threads in the pid namespace, using next_pidmap(). >> > Even though nr_hashed == 2, only the hanging thread is still >> > present. >> >> For your testcase? I suspect you copied the code from >> zap_pid_ns_processes and skipped pid 1. It is going to be pid 1 that is >> calling zap_pid_ns_processes. >> > > Almost. Something along the line of > > count = 0; > nr = next_pidmap(pid_ns, 0); > while (nr > 0) { > count++; > nr = next_pidmap(pid_ns, nr); > } > > only I also call sched_show_task() for each thread, and the only > one printed is the one that hangs in zap_pid_ns_processes(). The function sched_show_task() does: if (!try_get_task_stack(p)) return; Which won't work on a zombie who has already released it's stack. Which is exactly what child2 should be at that point. Eric