]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: ensure initialized cpuset controller 2688/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 10 Oct 2018 11:27:45 +0000 (13:27 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 10 Oct 2018 11:27:45 +0000 (13:27 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 4aa8fe160c7acb9b8322521eec506b0e0b43c19a..1a722ae2f5f4f2a6dbd46b7885ddb0a41b9d945b 100644 (file)
@@ -1153,6 +1153,7 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
        for (int i = 0; ops->hierarchies[i]; i++) {
                int ret;
                char *chop;
+               char pivot_cgroup[] = PIVOT_CGROUP;
                struct hierarchy *h = ops->hierarchies[i];
 
                if (!h->monitor_full_path)
@@ -1174,6 +1175,15 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
                if (chop)
                        *chop = '\0';
 
+               /*
+                * Make sure not to pass in the ro string literal PIVOT_CGROUP
+                * here.
+                */
+               if (!cg_legacy_handle_cpuset_hierarchy(h, pivot_cgroup)) {
+                       WARN("Failed to handle legacy cpuset controller");
+                       goto next;
+               }
+
                ret = mkdir_p(pivot_path, 0755);
                if (ret < 0 && errno != EEXIST) {
                        SYSWARN("Failed to create cgroup \"%s\"\n", pivot_path);