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 6099dd5a
......@@ -1297,6 +1297,11 @@ static bool monitor_create_path_for_hierarchy(struct hierarchy *h, char *cgname)
{
int ret;
if (!cg_legacy_handle_cpuset_hierarchy(h, cgname)) {
ERROR("Failed to handle legacy cpuset controller");
return false;
}
h->monitor_full_path = must_make_path(h->mountpoint, h->container_base_path, cgname, NULL);
ret = mkdir_eexist_on_last(h->monitor_full_path, 0755);
if (ret < 0) {
......@@ -1304,11 +1309,6 @@ static bool monitor_create_path_for_hierarchy(struct hierarchy *h, char *cgname)
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);
}
......@@ -1316,6 +1316,11 @@ static bool container_create_path_for_hierarchy(struct hierarchy *h, char *cgnam
{
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);
ret = mkdir_eexist_on_last(h->container_full_path, 0755);
if (ret < 0) {
......@@ -1323,11 +1328,6 @@ static bool container_create_path_for_hierarchy(struct hierarchy *h, char *cgnam
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);
}
......
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