]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: ignore cgroup2 limits on non-cgroup2 layouts
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 3 May 2020 09:59:15 +0000 (11:59 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 3 May 2020 09:59:15 +0000 (11:59 +0200)
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 <thomas.moschny@gmx.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 37309c9ead26747e14e859914d3c15eed857479b..7dfdc4e2d5e9f6a68fa3e3349cccf042109386c8 100644 (file)
@@ -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;