From: Christian Brauner Date: Sun, 3 May 2020 09:59:15 +0000 (+0200) Subject: cgroups: ignore cgroup2 limits on non-cgroup2 layouts X-Git-Tag: lxc-5.0.0~443^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e7a013ee850f5388f17e562e663268f24903a9b;p=thirdparty%2Flxc.git cgroups: ignore cgroup2 limits on non-cgroup2 layouts Mixing cgroup2 and legacy cgroup systems such that some controllers are enabled in legacy cgroup hierarchies and other controllers in the unified hierarchies is simply not something we're supporting. Even systemd's hybrid layout (crazy) doesn't bind controllers to the unified cgroup hierarchy. Fixes: #3183 Cc: Thomas Moschny Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 37309c9ea..7dfdc4e2d 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2928,9 +2928,12 @@ __cgfsng_ops static bool cgfsng_setup_limits(struct cgroup_ops *ops, return ret_set_errno(false, EINVAL); conf = handler->conf; - if (lxc_list_empty(&conf->cgroup2)) - return true; cgroup_settings = &conf->cgroup2; + if (lxc_list_empty(cgroup_settings)) + return true; + + if (!pure_unified_layout(ops)) + return log_warn_errno(true, EINVAL, "Ignoring cgroup2 limits on legacy cgroup system"); if (!ops->unified) return false;