From: Christian Brauner Date: Wed, 17 Mar 2021 08:24:56 +0000 (+0100) Subject: cgroups: ignore unused controllers X-Git-Tag: lxc-5.0.0~259^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6159413bc9dfe2dc2d7598dedb36df45e5b40747;p=thirdparty%2Flxc.git cgroups: ignore unused controllers Someone might have created a name= controller after the container has started and so the container doesn't make use of this controller. Link: https://github.com/lxc/lxd/issues/8577 Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 46ed69714..f66790a4d 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -2363,9 +2363,17 @@ __cgfsng_ops static bool cgfsng_attach(struct cgroup_ops *ops, } path = lxc_cmd_get_cgroup_path(name, lxcpath, h->controllers[0]); - /* not running */ - if (!path) - return false; + if (!path) { + /* + * Someone might have created a name= + * controller after the container has started and so + * the container doesn't make use of this controller. + * + * Link: https://github.com/lxc/lxd/issues/8577 + */ + TRACE("Skipping unused %s controller", maybe_empty(h->controllers[0])); + continue; + } fullpath = build_full_cgpath_from_monitorpath(h, path, "cgroup.procs"); ret = lxc_write_to_file(fullpath, pidstr, len, false, 0666);