All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: kyler.zhangkui@huawei.com
Cc: cgroups@vger.kernel.org, zhihui.gao@huawei.com,
	chenjie6@huawei.com, lizefan@huawei.com, stable@vger.kernel.org
Subject: Re: [PATCH] cgroup: bug fix of cgroup_root object was not released after cgroup umounted
Date: Mon, 14 Dec 2015 14:51:39 -0500	[thread overview]
Message-ID: <20151214195139.GB4026@mtj.duckdns.org> (raw)
In-Reply-To: <1450093554-24474-1-git-send-email-kyler.zhangkui@huawei.com>

Hello, Zhang.

On Mon, Dec 14, 2015 at 07:45:54PM +0800, kyler.zhangkui@huawei.com wrote:
> @@ -2147,6 +2147,13 @@ static void cgroup_kill_sb(struct super_block *sb)
>  {
>  	struct kernfs_root *kf_root = kernfs_root_from_sb(sb);
>  	struct cgroup_root *root = cgroup_root_from_kf(kf_root);
> +	struct cgroup *child;
> +	int live_child = 0;
> +
> +	mutex_lock(&cgroup_mutex);
> +	cgroup_for_each_live_child(child, &root->cgrp) {
> +		live_child++;
> +	}
>  
>  	/*
>  	 * If @root doesn't have any mounts or children, start killing it.
> @@ -2155,12 +2162,12 @@ static void cgroup_kill_sb(struct super_block *sb)
>  	 *
>  	 * And don't kill the default root.
>  	 */
> -	if (!list_empty(&root->cgrp.self.children) ||
> -	    root == &cgrp_dfl_root)
> -		cgroup_put(&root->cgrp);
> +	if (live_child || root == &cgrp_dfl_root)
> +	cgroup_put(&root->cgrp);
>  	else
>  		percpu_ref_kill(&root->cgrp.self.refcnt);
>  
> +	mutex_unlock(&cgroup_mutex);
>  	kernfs_kill_sb(sb);

I don't know.  With the above change, we might fail remounting with
the same option for some controllers which keep residual objects
around.  Changing controller associations has never been supported
correctly and I don't think it'll ever be.  I have no objection to
improving it but this has the potential to regress use cases which
would be more common.

Thanks.

-- 
tejun

      reply	other threads:[~2015-12-14 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 11:45 [PATCH] cgroup: bug fix of cgroup_root object was not released after cgroup umounted kyler.zhangkui
2015-12-14 11:45 ` kyler.zhangkui
2015-12-14 19:51 ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151214195139.GB4026@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=chenjie6@huawei.com \
    --cc=kyler.zhangkui@huawei.com \
    --cc=lizefan@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=zhihui.gao@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.