mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: 含黛 <handai.szj@taobao.com>
Cc: linux-kernel@vger.kernel.org, paul@paulmenage.org, lizf@cn.fujitsu.com
Subject: Re: cgroup umount bug
Date: Sat, 8 Oct 2011 18:18:13 +0000	[thread overview]
Message-ID: <20111008181813.GA27610@hallyn.com> (raw)
In-Reply-To: <1318075344.2168.4.camel@handai-OptiPlex-780>

Quoting 含黛 (handai.szj@taobao.com):
> Hi,
> 
>     I found a mount/umount problem while using cgroup: I mount a cpu
> cgroup (or other subsystems) and create some subgroups under it, but
> later I try to umount it without rmdir those subgroups. I find that I
> can umount it without any errors but actually the super block still
> exist. This is because the sb->s_active count is greater than 1 which
> was added by cgroup_create. But later if I want to mount both cpu and
> memory subsystems, it will be unsuccessful indicating that the
> device(cpu subsystem) is busy. This situation will not happen if I rmdir
> the subgroups manually before umount it. So my question is:
>     Should the umount return success when there are still some subgroups

Yes.  The fs was unmounted from that directory.

> exist ? If this is okay, then it may lead to some *strange* errors using
> cgroup later. If it can not be umount, then it should inform that the
> mount point is still busy.

> Following is an example of this problem:
> 
> mount -t cgroup -o cpu cgroup /mnt
> mkdir /mnt/test
> 
> …..// do some tests
> 
> umount /mnt      /* return successfully */
> 
> /* do other subsystems test */
> mount -cgroup -o cpu,cpuset cgroup /mnt
> mount: cgroup already mounted or /mnt busy  /*??? which is strange */

I'm not sure from what you write whether you're aware of this, but
to work around this, you can then

 mount -t cgroup -o cpu /mnt
 for i in `cat /mnt/test/tasks`; do
  echo $i > /mnt/tasks
 done
 rmdir /mnt/test
 umount /mnt

and now you can 

 mount -cgroup -o cpu,cpuset cgroup /mnt

Being unable to umount /mnt while child cgroups exist or having all
child cgroups cleared and removed automatically would both be less
useful behaviors.

thanks,
-serge

      reply	other threads:[~2011-10-08 18:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08 12:02 含黛
2011-10-08 18:18 ` Serge E. Hallyn [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=20111008181813.GA27610@hallyn.com \
    --to=serge@hallyn.com \
    --cc=handai.szj@taobao.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=paul@paulmenage.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

all inboxes | Powered by JetHome®