diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-02 19:57:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-02 22:04:54 -0400 |
commit | 0670e08bdfc67272f8c3087030417465629b8073 (patch) | |
tree | 44a4e3b6059aeb8c2a97d5fb8ccf743a2eaafd07 | |
parent | 099fca3225b39f7a3ed853036038054172b55581 (diff) |
cgroups: don't change release_agent when remount failed
Remount can fail in either case:
- wrong mount options is specified, or option 'noprefix' is changed.
- a to-be-added subsys is already mounted/active.
When using remount to change 'release_agent', for the above former failure
case, remount will return errno with release_agent unchanged, but for the
latter case, remount will return EBUSY with relase_agent changed, which is
unexpected I think:
# mount -t cgroup -o cpu xxx /cgrp1
# mount -t cgroup -o cpuset,release_agent=agent1 yyy /cgrp2
# cat /cgrp2/release_agent
agent1
# mount -t cgroup -o remount,cpuset,noprefix,release_agent=agent2 yyy /cgrp2
mount: /cgrp2 not mounted already, or bad option
# cat /cgrp2/release_agent
agent1 <-- ok
# mount -t cgroup -o remount,cpu,cpuset,release_agent=agent2 yyy /cgrp2
mount: /cgrp2 is busy
# cat /cgrp2/release_agent
agent2 <-- unexpected!
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/cgroup.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index fea11c5c990c..f2a3f5c9936c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -915,10 +915,11 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data) | |||
915 | } | 915 | } |
916 | 916 | ||
917 | ret = rebind_subsystems(root, opts.subsys_bits); | 917 | ret = rebind_subsystems(root, opts.subsys_bits); |
918 | if (ret) | ||
919 | goto out_unlock; | ||
918 | 920 | ||
919 | /* (re)populate subsystem files */ | 921 | /* (re)populate subsystem files */ |
920 | if (!ret) | 922 | cgroup_populate_dir(cgrp); |
921 | cgroup_populate_dir(cgrp); | ||
922 | 923 | ||
923 | if (opts.release_agent) | 924 | if (opts.release_agent) |
924 | strcpy(root->release_agent_path, opts.release_agent); | 925 | strcpy(root->release_agent_path, opts.release_agent); |