diff options
Diffstat (limited to 'kernel/cgroup.c')
| -rw-r--r-- | kernel/cgroup.c | 22 | 
1 files changed, 20 insertions, 2 deletions
| diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 1fbcc748044..4fd90e12977 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | */ | 23 | */ | 
| 24 | 24 | ||
| 25 | #include <linux/cgroup.h> | 25 | #include <linux/cgroup.h> | 
| 26 | #include <linux/module.h> | ||
| 26 | #include <linux/ctype.h> | 27 | #include <linux/ctype.h> | 
| 27 | #include <linux/errno.h> | 28 | #include <linux/errno.h> | 
| 28 | #include <linux/fs.h> | 29 | #include <linux/fs.h> | 
| @@ -166,6 +167,20 @@ static DEFINE_SPINLOCK(hierarchy_id_lock); | |||
| 166 | */ | 167 | */ | 
| 167 | static int need_forkexit_callback __read_mostly; | 168 | static int need_forkexit_callback __read_mostly; | 
| 168 | 169 | ||
| 170 | #ifdef CONFIG_PROVE_LOCKING | ||
| 171 | int cgroup_lock_is_held(void) | ||
| 172 | { | ||
| 173 | return lockdep_is_held(&cgroup_mutex); | ||
| 174 | } | ||
| 175 | #else /* #ifdef CONFIG_PROVE_LOCKING */ | ||
| 176 | int cgroup_lock_is_held(void) | ||
| 177 | { | ||
| 178 | return mutex_is_locked(&cgroup_mutex); | ||
| 179 | } | ||
| 180 | #endif /* #else #ifdef CONFIG_PROVE_LOCKING */ | ||
| 181 | |||
| 182 | EXPORT_SYMBOL_GPL(cgroup_lock_is_held); | ||
| 183 | |||
| 169 | /* convenient tests for these bits */ | 184 | /* convenient tests for these bits */ | 
| 170 | inline int cgroup_is_removed(const struct cgroup *cgrp) | 185 | inline int cgroup_is_removed(const struct cgroup *cgrp) | 
| 171 | { | 186 | { | 
| @@ -2936,14 +2951,17 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, | |||
| 2936 | 2951 | ||
| 2937 | for_each_subsys(root, ss) { | 2952 | for_each_subsys(root, ss) { | 
| 2938 | struct cgroup_subsys_state *css = ss->create(ss, cgrp); | 2953 | struct cgroup_subsys_state *css = ss->create(ss, cgrp); | 
| 2954 | |||
| 2939 | if (IS_ERR(css)) { | 2955 | if (IS_ERR(css)) { | 
| 2940 | err = PTR_ERR(css); | 2956 | err = PTR_ERR(css); | 
| 2941 | goto err_destroy; | 2957 | goto err_destroy; | 
| 2942 | } | 2958 | } | 
| 2943 | init_cgroup_css(css, ss, cgrp); | 2959 | init_cgroup_css(css, ss, cgrp); | 
| 2944 | if (ss->use_id) | 2960 | if (ss->use_id) { | 
| 2945 | if (alloc_css_id(ss, parent, cgrp)) | 2961 | err = alloc_css_id(ss, parent, cgrp); | 
| 2962 | if (err) | ||
| 2946 | goto err_destroy; | 2963 | goto err_destroy; | 
| 2964 | } | ||
| 2947 | /* At error, ->destroy() callback has to free assigned ID. */ | 2965 | /* At error, ->destroy() callback has to free assigned ID. */ | 
| 2948 | } | 2966 | } | 
| 2949 | 2967 | ||
