public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Ben Blum <bblum@andrew.cmu.edu>
Cc: linux-kernel@vger.kernel.org,
	containers@lists.linux-foundation.org, akpm@linux-foundation.org,
	menage@google.com
Subject: Re: [RFC] [PATCH 1/5] cgroups: revamp subsys array
Date: Tue, 08 Dec 2009 15:38:43 +0800	[thread overview]
Message-ID: <4B1E0283.70108@cn.fujitsu.com> (raw)
In-Reply-To: <20091204085508.GA18912@andrew.cmu.edu>

> @@ -1291,6 +1324,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
>  	struct cgroupfs_root *new_root;
>  
>  	/* First find the desired set of subsystems */
> +	down_read(&subsys_mutex);

Hmm.. this can lead to deadlock. sget() returns success with sb->s_umount
held, so here we have:

	down_read(&subsys_mutex);

	down_write(&sb->s_umount);

On the other hand, sb->s_umount is held before calling kill_sb(),
so when umounting we have:

	down_write(&sb->s_umount);

	down_read(&subsys_mutex);

>  	ret = parse_cgroupfs_options(data, &opts);
>  	if (ret)
>  		goto out_err;
> @@ -1367,6 +1401,8 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
>  			free_cg_links(&tmp_cg_links);
>  			goto drop_new_super;
>  		}
> +		/* done with subsys stuff and no other failure case */
> +		up_read(&subsys_mutex);
>  
>  		/* EBUSY should be the only error here */
>  		BUG_ON(ret);
> @@ -1415,6 +1451,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
>   drop_new_super:
>  	deactivate_locked_super(sb);
>   out_err:
> +	up_read(&subsys_mutex);
>  	kfree(opts.release_agent);
>  	kfree(opts.name);
>  
> @@ -1434,10 +1471,12 @@ static void cgroup_kill_sb(struct super_block *sb) {
>  	BUG_ON(!list_empty(&cgrp->children));
>  	BUG_ON(!list_empty(&cgrp->sibling));
>  
> +	down_read(&subsys_mutex);
>  	mutex_lock(&cgroup_mutex);
>  
>  	/* Rebind all subsystems back to the default hierarchy */
>  	ret = rebind_subsystems(root, 0);
> +	up_read(&subsys_mutex);
>  	/* Shouldn't be able to fail ... */
>  	BUG_ON(ret);
>  



  reply	other threads:[~2009-12-08  7:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04  8:53 [RFC] [PATCH 0/5] cgroups: support for module-loadable subsystems Ben Blum
2009-12-04  8:55 ` [RFC] [PATCH 1/5] cgroups: revamp subsys array Ben Blum
2009-12-08  7:38   ` Li Zefan [this message]
2009-12-09  5:50     ` Ben Blum
2009-12-09  6:07       ` Li Zefan
2009-12-09  6:09         ` Li Zefan
2009-12-09  8:27         ` Ben Blum
2009-12-10  3:18           ` Li Zefan
2009-12-10  5:19             ` Ben Blum
2009-12-10  6:00               ` Li Zefan
2009-12-10  6:13                 ` Ben Blum
2009-12-09  8:36     ` Ben Blum
2009-12-04  8:56 ` [RFC] [PATCH 2/5] cgroups: subsystem module loading interface Ben Blum
2009-12-04  8:57 ` [RFC] [PATCH 3/5] cgroups: net_cls as module Ben Blum
2009-12-08  6:07   ` Li Zefan
2009-12-04  8:58 ` [RFC] [PATCH 4/5] cgroups: subsystem module unloading Ben Blum
2009-12-04  8:58 ` [RFC] [PATCH 5/5] cgroups: subsystem dependencies Ben Blum
2009-12-08  6:11   ` Li Zefan
2009-12-09  1:08     ` Ben Blum
2009-12-09  1:40       ` Li Zefan

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=4B1E0283.70108@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=bblum@andrew.cmu.edu \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox