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

From: Li Zefan <[email-masked]>
Date: Fri, 16 Aug 2013 18:16:18 +0800

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]>