cgroup: move list add after list head initilization
authorLi Zhong <zhong@linux.vnet.ibm.com>
Wed, 28 Nov 2012 09:15:21 +0000 (17:15 +0800)
committerTejun Heo <tj@kernel.org>
Wed, 28 Nov 2012 14:02:39 +0000 (06:02 -0800)
2243076ad1 ("cgroup: initialize cgrp->allcg_node in
init_cgroup_housekeeping()") initializes cgrp->allcg_node in
init_cgroup_housekeeping().  Then in init_cgroup_root(), we should
call init_cgroup_housekeeping() before adding it to &root->allcg_list;
otherwise, we are initializing an entry already in a list.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup.c

index 55a0a770a5a237645ec72a2706116742f2ddc454..c02b05560d10edf7364028ea1e23dc7735165e24 100644 (file)
@@ -1401,8 +1401,8 @@ static void init_cgroup_root(struct cgroupfs_root *root)
        root->number_of_cgroups = 1;
        cgrp->root = root;
        cgrp->top_cgroup = cgrp;
-       list_add_tail(&cgrp->allcg_node, &root->allcg_list);
        init_cgroup_housekeeping(cgrp);
+       list_add_tail(&cgrp->allcg_node, &root->allcg_list);
 }
 
 static bool init_root_id(struct cgroupfs_root *root)