Subject: Re: [RFC PATCH next]cgroup: use css_get() in cgroup_create() to check CSS_ROOT

From: Tejun Heo <[email-masked]>
Date: Fri, 16 Aug 2013 10:58:05 -0400

On Fri, Aug 16, 2013 at 06:16:18PM +0800, Li Zefan wrote:
> On 2013/8/16 17:57, Li Zhong wrote:
> > It seems that the root css doesn't have refcnt allocated(not needed?),
> > and would cause the booting error attached.
> > 
> > This patch tries to use css_get() to not increase the refcnt if parent
> > is root.
> ...
> > diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> > index 723194f..781f8cd 100644
> > --- a/kernel/cgroup.c
> > +++ b/kernel/cgroup.c
> > @@ -4485,7 +4485,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
> >  		struct cgroup_subsys_state *css = css_ar[ss->subsys_id];
> >  
> >  		dget(dentry);
> > -		percpu_ref_get(&css->parent->refcnt);
> > +		css_get(css->parent);
> 
> We use css_put() to drop this refcnt, so it makes sense to use css_get()
> for consistency.
> 
> Acked-by: Li Zefan <[email-masked]>

Heh, this doesn't trigger on my test setup for some reason.  Applied.
Thanks a lot.

-- 
tejun