From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 1/3] don't attach a task to a dead cgroup Date: Thu, 19 Apr 2012 15:53:22 -0700 Message-ID: <20120419225322.GC10553@google.com> References: <1334875758-20939-1-git-send-email-glommer@parallels.com> <1334875758-20939-2-git-send-email-glommer@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Li Zefan , kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org, David Miller , devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org To: Glauber Costa Return-path: Content-Disposition: inline In-Reply-To: <1334875758-20939-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org On Thu, Apr 19, 2012 at 07:49:16PM -0300, Glauber Costa wrote: > Not all external callers of cgroup_attach_task() test to > see if the cgroup is still live - the internal callers at > cgroup.c does. > > With this test in cgroup_attach_task, we can assure that > no tasks are ever moved to a cgroup that is past its > destruction point and was already marked as dead. > > Signed-off-by: Glauber Costa > CC: Tejun Heo > CC: Li Zefan > CC: Kamezawa Hiroyuki > --- > kernel/cgroup.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index b61b938..932c318 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -1927,6 +1927,9 @@ int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) > struct cgroup_taskset tset = { }; > struct css_set *newcg; > > + if (cgroup_is_removed(cgrp)) > + return -ENODEV; > + Isn't the test in cgroup_lock_live_group() enough? -- tejun