cgfsng: handle v1 cpuset hierarchy first

If the value of cgroup.clone_children in our immediate ancestor cgroup is 0 then the cpuset of any cgroups we create in subtrees will be empty and hence we'll copy an empty cpuset at which point we cannot enter the cpuset cgroup. Avoid this problem by initializing cgroup.clone_children to 1 an copying the initialized cpuset of our immediate ancestor. Note, that the cpuset of our immediate ancestor must be initialized and ours as well otherwise we couldn't be located in this cgroup. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 21d298c1
...@@ -1243,6 +1243,11 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname) ...@@ -1243,6 +1243,11 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
{ {
int ret; int ret;
if (!cg_legacy_handle_cpuset_hierarchy(h, cgname)) {
ERROR("Failed to handle legacy cpuset controller");
return false;
}
h->container_full_path = must_make_path(h->mountpoint, h->container_base_path, cgname, NULL); h->container_full_path = must_make_path(h->mountpoint, h->container_base_path, cgname, NULL);
ret = mkdir_eexist_on_last(h->container_full_path, 0755); ret = mkdir_eexist_on_last(h->container_full_path, 0755);
if (ret < 0) { if (ret < 0) {
...@@ -1250,11 +1255,6 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname) ...@@ -1250,11 +1255,6 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
return false; return false;
} }
if (!cg_legacy_handle_cpuset_hierarchy(h, cgname)) {
ERROR("Failed to handle legacy cpuset controller");
return false;
}
return cg_unified_create_cgroup(h, cgname); return cg_unified_create_cgroup(h, cgname);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment