aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2ae7cb47dbfa..0066092de19a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2993,20 +2993,21 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
2993 mutex_unlock(&cgroup_mutex); 2993 mutex_unlock(&cgroup_mutex);
2994 return 0; 2994 return 0;
2995 } 2995 }
2996 task_lock(tsk);
2997 cg = tsk->cgroups;
2998 parent = task_cgroup(tsk, subsys->subsys_id);
2999 2996
3000 /* Pin the hierarchy */ 2997 /* Pin the hierarchy */
3001 if (!atomic_inc_not_zero(&parent->root->sb->s_active)) { 2998 if (!atomic_inc_not_zero(&root->sb->s_active)) {
3002 /* We race with the final deactivate_super() */ 2999 /* We race with the final deactivate_super() */
3003 mutex_unlock(&cgroup_mutex); 3000 mutex_unlock(&cgroup_mutex);
3004 return 0; 3001 return 0;
3005 } 3002 }
3006 3003
3007 /* Keep the cgroup alive */ 3004 /* Keep the cgroup alive */
3005 task_lock(tsk);
3006 parent = task_cgroup(tsk, subsys->subsys_id);
3007 cg = tsk->cgroups;
3008 get_css_set(cg); 3008 get_css_set(cg);
3009 task_unlock(tsk); 3009 task_unlock(tsk);
3010
3010 mutex_unlock(&cgroup_mutex); 3011 mutex_unlock(&cgroup_mutex);
3011 3012
3012 /* Now do the VFS work to create a cgroup */ 3013 /* Now do the VFS work to create a cgroup */
@@ -3045,7 +3046,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
3045 mutex_unlock(&inode->i_mutex); 3046 mutex_unlock(&inode->i_mutex);
3046 put_css_set(cg); 3047 put_css_set(cg);
3047 3048
3048 deactivate_super(parent->root->sb); 3049 deactivate_super(root->sb);
3049 /* The cgroup is still accessible in the VFS, but 3050 /* The cgroup is still accessible in the VFS, but
3050 * we're not going to try to rmdir() it at this 3051 * we're not going to try to rmdir() it at this
3051 * point. */ 3052 * point. */
@@ -3071,7 +3072,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys,
3071 mutex_lock(&cgroup_mutex); 3072 mutex_lock(&cgroup_mutex);
3072 put_css_set(cg); 3073 put_css_set(cg);
3073 mutex_unlock(&cgroup_mutex); 3074 mutex_unlock(&cgroup_mutex);
3074 deactivate_super(parent->root->sb); 3075 deactivate_super(root->sb);
3075 return ret; 3076 return ret;
3076} 3077}
3077 3078