cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v3 3/3] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb()
Date: Mon, 30 Jun 2014 10:23:24 -0400	[thread overview]
Message-ID: <20140630142324.GD14807@htj.dyndns.org> (raw)
In-Reply-To: <53B0DEA3.80807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

Hello, Li.

I applied the three patches with some updates (mostly comments).
Dynamic root management is turning out to be pretty ugly but I think
we can clean it up a bit.

On Mon, Jun 30, 2014 at 11:50:59AM +0800, Li Zefan wrote:
> @@ -1790,6 +1795,17 @@ out_free:
>  	dentry = kernfs_mount(fs_type, flags, root->kf_root, &new_sb);
>  	if (IS_ERR(dentry) || !new_sb)
>  		cgroup_put(&root->cgrp);
> +
> +	if (sb) {
> +		/*
> +		 * On success kernfs_mount() returns with sb->s_umount held,
> +		 * but kernfs_mount() also increases the superblock's refcnt,
> +		 * so calling deactivate_super() to drop the refcnt we got when
> +		 * looking up cgroup root won't acquire sb->s_umount again.
> +		 */
> +		WARN_ON(new_sb);
> +		deactivate_super(sb);
> +	}

So, @new_sb and @sb indicate the same conditions now.  When we reuse
an existing root, we always reuse its sb too which means that we at
least no longer need the @new_sb ugliness.  I actually kinda prefer it
as this means that the ugliness is confined to one ugly function -
kernfs_pin_sb() - instead of the generic kernfs_mount().  Can you
please prepare patches to clean these up?  I'll pull in for-3.16-fixes
into for-3.17 and apply the cleanup on top.

Thanks!

-- 
tejun

  parent reply	other threads:[~2014-06-30 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30  3:49 [PATCH v3 1/3] cgroup: fix mount failure in a corner case Li Zefan
     [not found] ` <53B0DE66.5080100-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-06-30  3:50   ` [PATCH v3 2/3] kernfs: introduce kernfs_pin_sb() Li Zefan
     [not found]     ` <53B0DE84.40206-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-06-30 14:19       ` Tejun Heo
2014-06-30  3:50   ` [PATCH v3 3/3] cgroup: fix a race between cgroup_mount() and cgroup_kill_sb() Li Zefan
     [not found]     ` <53B0DEA3.80807-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-06-30 14:19       ` Tejun Heo
2014-06-30 14:23       ` Tejun Heo [this message]
2014-06-30 14:18   ` [PATCH v3 1/3] cgroup: fix mount failure in a corner case Tejun Heo

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=20140630142324.GD14807@htj.dyndns.org \
    --to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).