From: Christian Brauner Date: Wed, 3 Oct 2018 10:23:36 +0000 (+0200) Subject: cgfsng: handle v1 cpuset hierarchy first X-Git-Tag: lxc-3.1.0~66^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef1853605066aa15630424340f2d7777964ed5d9;p=thirdparty%2Flxc.git 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: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index ec4501c33..97913209c 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -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); }