Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760813Ab0FQVWK (ORCPT ); Thu, 17 Jun 2010 17:22:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26617 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757635Ab0FQVWH (ORCPT ); Thu, 17 Jun 2010 17:22:07 -0400 Date: Thu, 17 Jun 2010 23:20:03 +0200 From: Oleg Nesterov To: Louis Rilling Cc: Andrew Morton , Pavel Emelyanov , Linux Containers , linux-kernel@vger.kernel.org Subject: Re: [PATCH] procfs: Do not release pid_ns->proc_mnt too early Message-ID: <20100617212003.GA4182@redhat.com> References: <1276706068-18567-1-git-send-email-louis.rilling@kerlabs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1276706068-18567-1-git-send-email-louis.rilling@kerlabs.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1309 Lines: 44 On 06/16, Louis Rilling wrote: > > Detached tasks are not seen by zap_pid_ns_processes()->sys_wait4(), so > that release_task()->proc_flush_task() of container init can be called > before it is for some detached tasks in the namespace. > > Pin proc_mnt's in copy_process(), so that proc_flush_task() becomes safe > whatever the ordering of tasks. I must have missed something, but can't we just move mntput() ? Oleg. --- x/kernel/pid_namespace.c +++ x/kernel/pid_namespace.c @@ -110,6 +110,9 @@ static void destroy_pid_namespace(struct { int i; + if (ns->proc_mount) + mntput(ns->proc_mount); + for (i = 0; i < PIDMAP_ENTRIES; i++) kfree(ns->pidmap[i].page); kmem_cache_free(pid_ns_cachep, ns); --- x/fs/proc/base.c +++ x/fs/proc/base.c @@ -2745,10 +2745,6 @@ void proc_flush_task(struct task_struct proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr, tgid->numbers[i].nr); } - - upid = &pid->numbers[pid->level]; - if (upid->nr == 1) - pid_ns_release_proc(upid->ns); } static struct dentry *proc_pid_instantiate(struct inode *dir, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/