diff options
Diffstat (limited to 'kernel/cgroup.c')
| -rw-r--r-- | kernel/cgroup.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index a7267bfd3765..3737a682cdf5 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include <linux/cgroupstats.h> | 46 | #include <linux/cgroupstats.h> |
| 47 | #include <linux/hash.h> | 47 | #include <linux/hash.h> |
| 48 | #include <linux/namei.h> | 48 | #include <linux/namei.h> |
| 49 | #include <linux/smp_lock.h> | ||
| 49 | 50 | ||
| 50 | #include <asm/atomic.h> | 51 | #include <asm/atomic.h> |
| 51 | 52 | ||
| @@ -842,6 +843,11 @@ static int parse_cgroupfs_options(char *data, | |||
| 842 | struct cgroup_sb_opts *opts) | 843 | struct cgroup_sb_opts *opts) |
| 843 | { | 844 | { |
| 844 | char *token, *o = data ?: "all"; | 845 | char *token, *o = data ?: "all"; |
| 846 | unsigned long mask = (unsigned long)-1; | ||
| 847 | |||
| 848 | #ifdef CONFIG_CPUSETS | ||
| 849 | mask = ~(1UL << cpuset_subsys_id); | ||
| 850 | #endif | ||
| 845 | 851 | ||
| 846 | opts->subsys_bits = 0; | 852 | opts->subsys_bits = 0; |
| 847 | opts->flags = 0; | 853 | opts->flags = 0; |
| @@ -886,6 +892,15 @@ static int parse_cgroupfs_options(char *data, | |||
| 886 | } | 892 | } |
| 887 | } | 893 | } |
| 888 | 894 | ||
| 895 | /* | ||
| 896 | * Option noprefix was introduced just for backward compatibility | ||
| 897 | * with the old cpuset, so we allow noprefix only if mounting just | ||
| 898 | * the cpuset subsystem. | ||
| 899 | */ | ||
| 900 | if (test_bit(ROOT_NOPREFIX, &opts->flags) && | ||
| 901 | (opts->subsys_bits & mask)) | ||
| 902 | return -EINVAL; | ||
| 903 | |||
| 889 | /* We can't have an empty hierarchy */ | 904 | /* We can't have an empty hierarchy */ |
| 890 | if (!opts->subsys_bits) | 905 | if (!opts->subsys_bits) |
| 891 | return -EINVAL; | 906 | return -EINVAL; |
| @@ -900,6 +915,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data) | |||
| 900 | struct cgroup *cgrp = &root->top_cgroup; | 915 | struct cgroup *cgrp = &root->top_cgroup; |
| 901 | struct cgroup_sb_opts opts; | 916 | struct cgroup_sb_opts opts; |
| 902 | 917 | ||
| 918 | lock_kernel(); | ||
| 903 | mutex_lock(&cgrp->dentry->d_inode->i_mutex); | 919 | mutex_lock(&cgrp->dentry->d_inode->i_mutex); |
| 904 | mutex_lock(&cgroup_mutex); | 920 | mutex_lock(&cgroup_mutex); |
| 905 | 921 | ||
| @@ -927,6 +943,7 @@ static int cgroup_remount(struct super_block *sb, int *flags, char *data) | |||
| 927 | kfree(opts.release_agent); | 943 | kfree(opts.release_agent); |
| 928 | mutex_unlock(&cgroup_mutex); | 944 | mutex_unlock(&cgroup_mutex); |
| 929 | mutex_unlock(&cgrp->dentry->d_inode->i_mutex); | 945 | mutex_unlock(&cgrp->dentry->d_inode->i_mutex); |
| 946 | unlock_kernel(); | ||
| 930 | return ret; | 947 | return ret; |
| 931 | } | 948 | } |
| 932 | 949 | ||
