From: Christian Brauner Date: Thu, 10 Nov 2016 23:29:15 +0000 (+0100) Subject: cgroups: skip v2 hierarchy entry X-Git-Tag: lxc-2.1.0~271^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1290%2Fhead;p=thirdparty%2Flxc.git cgroups: skip v2 hierarchy entry Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index ec940995f..992096a83 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -686,6 +686,18 @@ static void get_existing_subsystems(char ***klist, char ***nlist) if (!p2) continue; *p2 = '\0'; + + /* If we have a mixture between cgroup v1 and cgroup v2 + * hierarchies, then /proc/self/cgroup contains entries of the + * form: + * + * 0::/some/path + * + * We need to skip those. + */ + if ((p2 - p) == 0) + continue; + for (tok = strtok_r(p, ",", &saveptr); tok; tok = strtok_r(NULL, ",", &saveptr)) { if (strncmp(tok, "name=", 5) == 0)