diff options
-rw-r--r-- | include/linux/cgroup.h | 2 | ||||
-rw-r--r-- | kernel/cgroup.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 5a85b3415c1..ad2a14680b7 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -191,6 +191,8 @@ struct cgroup { | |||
191 | */ | 191 | */ |
192 | struct list_head css_sets; | 192 | struct list_head css_sets; |
193 | 193 | ||
194 | struct list_head allcg_node; /* cgroupfs_root->allcg_list */ | ||
195 | |||
194 | /* | 196 | /* |
195 | * Linked list running through all cgroups that can | 197 | * Linked list running through all cgroups that can |
196 | * potentially be reaped by the release agent. Protected by | 198 | * potentially be reaped by the release agent. Protected by |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 8f72853131d..db4319c030d 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -127,6 +127,9 @@ struct cgroupfs_root { | |||
127 | /* A list running through the active hierarchies */ | 127 | /* A list running through the active hierarchies */ |
128 | struct list_head root_list; | 128 | struct list_head root_list; |
129 | 129 | ||
130 | /* All cgroups on this root, cgroup_mutex protected */ | ||
131 | struct list_head allcg_list; | ||
132 | |||
130 | /* Hierarchy-specific flags */ | 133 | /* Hierarchy-specific flags */ |
131 | unsigned long flags; | 134 | unsigned long flags; |
132 | 135 | ||
@@ -1350,11 +1353,14 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp) | |||
1350 | static void init_cgroup_root(struct cgroupfs_root *root) | 1353 | static void init_cgroup_root(struct cgroupfs_root *root) |
1351 | { | 1354 | { |
1352 | struct cgroup *cgrp = &root->top_cgroup; | 1355 | struct cgroup *cgrp = &root->top_cgroup; |
1356 | |||
1353 | INIT_LIST_HEAD(&root->subsys_list); | 1357 | INIT_LIST_HEAD(&root->subsys_list); |
1354 | INIT_LIST_HEAD(&root->root_list); | 1358 | INIT_LIST_HEAD(&root->root_list); |
1359 | INIT_LIST_HEAD(&root->allcg_list); | ||
1355 | root->number_of_cgroups = 1; | 1360 | root->number_of_cgroups = 1; |
1356 | cgrp->root = root; | 1361 | cgrp->root = root; |
1357 | cgrp->top_cgroup = cgrp; | 1362 | cgrp->top_cgroup = cgrp; |
1363 | list_add_tail(&cgrp->allcg_node, &root->allcg_list); | ||
1358 | init_cgroup_housekeeping(cgrp); | 1364 | init_cgroup_housekeeping(cgrp); |
1359 | } | 1365 | } |
1360 | 1366 | ||
@@ -3790,6 +3796,8 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, | |||
3790 | /* The cgroup directory was pre-locked for us */ | 3796 | /* The cgroup directory was pre-locked for us */ |
3791 | BUG_ON(!mutex_is_locked(&cgrp->dentry->d_inode->i_mutex)); | 3797 | BUG_ON(!mutex_is_locked(&cgrp->dentry->d_inode->i_mutex)); |
3792 | 3798 | ||
3799 | list_add_tail(&cgrp->allcg_node, &root->allcg_list); | ||
3800 | |||
3793 | err = cgroup_populate_dir(cgrp); | 3801 | err = cgroup_populate_dir(cgrp); |
3794 | /* If err < 0, we have a half-filled directory - oh well ;) */ | 3802 | /* If err < 0, we have a half-filled directory - oh well ;) */ |
3795 | 3803 | ||
@@ -3998,6 +4006,8 @@ again: | |||
3998 | list_del_init(&cgrp->sibling); | 4006 | list_del_init(&cgrp->sibling); |
3999 | cgroup_unlock_hierarchy(cgrp->root); | 4007 | cgroup_unlock_hierarchy(cgrp->root); |
4000 | 4008 | ||
4009 | list_del_init(&cgrp->allcg_node); | ||
4010 | |||
4001 | d = dget(cgrp->dentry); | 4011 | d = dget(cgrp->dentry); |
4002 | 4012 | ||
4003 | cgroup_d_remove_dir(d); | 4013 | cgroup_d_remove_dir(d); |