[lxc-devel] [lxc/master] cgroups: initialize lxc.pivot cpuset

brauner on Github lxc-bot at linuxcontainers.org
Wed Jun 10 15:42:49 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 380 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200610/d301d0ba/attachment.bin>
-------------- next part --------------
From 77ffeed2b3c01f536ed10695dd94d861eac3079b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 10 Jun 2020 17:40:56 +0200
Subject: [PATCH] cgroups: initialize lxc.pivot cpuset

Closes: #3443.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/cgroups/cgfsng.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 05fdc0c5d2..6c64c996c2 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -1082,6 +1082,7 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
 	for (int i = 0; ops->hierarchies[i]; i++) {
 		__do_free char *pivot_path = NULL;
 		struct hierarchy *h = ops->hierarchies[i];
+		size_t offset;
 		int ret;
 
 		if (!h->monitor_full_path)
@@ -1094,20 +1095,20 @@ __cgfsng_ops static void cgfsng_monitor_destroy(struct cgroup_ops *ops,
 		}
 
 		if (conf && conf->cgroup_meta.monitor_dir)
-			pivot_path = must_make_path(h->mountpoint,
-						    h->container_base_path,
-						    conf->cgroup_meta.monitor_dir,
-						    CGROUP_PIVOT, NULL);
+			pivot_path = must_make_path(h->mountpoint, h->container_base_path,
+						    conf->cgroup_meta.monitor_dir, CGROUP_PIVOT, NULL);
 		else if (conf && conf->cgroup_meta.dir)
-			pivot_path = must_make_path(h->mountpoint,
-						    h->container_base_path,
-						    conf->cgroup_meta.dir,
-						    CGROUP_PIVOT, NULL);
+			pivot_path = must_make_path(h->mountpoint, h->container_base_path,
+						    conf->cgroup_meta.dir, CGROUP_PIVOT, NULL);
 		else
-			pivot_path = must_make_path(h->mountpoint,
-						    h->container_base_path,
+			pivot_path = must_make_path(h->mountpoint, h->container_base_path,
 						    CGROUP_PIVOT, NULL);
 
+		offset = strlen(h->mountpoint) + strlen(h->container_base_path);
+
+		if (cg_legacy_handle_cpuset_hierarchy(h, pivot_path + offset))
+			SYSWARN("Failed to initialize cpuset %s/" CGROUP_PIVOT, pivot_path);
+
 		ret = mkdir_p(pivot_path, 0755);
 		if (ret < 0 && errno != EEXIST) {
 			ERROR("Failed to create %s", pivot_path);


More information about the lxc-devel mailing list