[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87fvzia1zi.fsf@xmission.com>
Date: Tue, 26 Mar 2013 03:29:05 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@...hat.com>
Cc: Caj Larsson <caj@...icloud.com>, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: Zombie stuck in zap_pid_ns_processes()
Oleg Nesterov <oleg@...hat.com> writes:
> On 03/24, Eric W. Biederman wrote:
>>
>> --- a/kernel/pid_namespace.c
>> +++ b/kernel/pid_namespace.c
>> @@ -181,6 +181,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
>> int nr;
>> int rc;
>> struct task_struct *task, *me = current;
>> + int init_pids = task_pid_vnr(me) == 1 ? 1 : 2;
> ^^^^^^^^^^^^^^^^^^^^^
>
> Ah, mt-init.
>
> perhaps thread_group_leader(me) would be more clean/simple,
> but I won't insist of course.
It is. Thanks, I was going to follow the reaper but that changes when the
initial thread exits...
Here is my final version of the patch, that I will push shortly.
Eric
From: "Eric W. Biederman" <ebiederm@...ssion.com>
Date: Tue, 26 Mar 2013 02:27:11 -0700
Subject: [PATCH] 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.
Cc: stable@...r.kernel.org
Cc: Oleg Nesterov <oleg@...hat.com>
Reported-by: Caj Larsson <caj@...icloud.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
kernel/pid_namespace.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index c1c3dc1..bea15bd 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -181,6 +181,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
int nr;
int rc;
struct task_struct *task, *me = current;
+ int init_pids = thread_group_leader(me) ? 1 : 2;
/* Don't allow any more processes into the pid namespace */
disable_pid_allocation(pid_ns);
@@ -230,7 +231,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
*/
for (;;) {
set_current_state(TASK_UNINTERRUPTIBLE);
- if (pid_ns->nr_hashed == 1)
+ if (pid_ns->nr_hashed == init_pids)
break;
schedule();
}
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists