[lxc-devel] [lxc/master] 2019 08 30/cgroup fixes

brauner on Github lxc-bot at linuxcontainers.org
Thu Aug 29 12:06:12 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190829/380b915e/attachment.bin>
-------------- next part --------------
From 81468ea7c0315605c637506369cb37320b981339 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 29 Aug 2019 13:56:56 +0200
Subject: [PATCH 1/2] cgroups: check for empty cgroups on freeze/unfreeze

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/cgroups/cgfsng.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index be1fd87733..1300e24a3e 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -2003,6 +2003,9 @@ __cgfsng_ops static bool cgfsng_freeze(struct cgroup_ops *ops)
 	__do_fclose FILE *f = NULL;
 	struct hierarchy *h;
 
+	if (!ops->hierarchies)
+		return true;
+
 	if (ops->cgroup_layout != CGROUP_LAYOUT_UNIFIED) {
 		h = get_hierarchy(ops, "freezer");
 		if (!h)
@@ -2054,6 +2057,9 @@ __cgfsng_ops static bool cgfsng_unfreeze(struct cgroup_ops *ops)
 	__do_free char *fullpath = NULL;
 	struct hierarchy *h;
 
+	if (!ops->hierarchies)
+		return true;
+
 	if (ops->cgroup_layout != CGROUP_LAYOUT_UNIFIED) {
 		h = get_hierarchy(ops, "freezer");
 		if (!h)

From c18c6b63b8b6ba3e53734daa958b7e0182fb47c6 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 29 Aug 2019 14:05:17 +0200
Subject: [PATCH 2/2] cgroups: initialize cgroup root directory - encore

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/cgroups/cgfsng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 1300e24a3e..a5d6c01895 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -1795,8 +1795,8 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
 	else if (type == LXC_AUTO_CGROUP_FULL_NOSPEC)
 		type = LXC_AUTO_CGROUP_FULL_MIXED;
 
+	cgroup_root = must_make_path(root, "/sys/fs/cgroup", NULL);
 	if (ops->cgroup_layout == CGROUP_LAYOUT_UNIFIED) {
-		cgroup_root = must_make_path(root, "/sys/fs/cgroup", NULL);
 		if (has_cgns && wants_force_mount) {
 			/* If cgroup namespaces are supported but the container
 			 * will not have CAP_SYS_ADMIN after it has started we


More information about the lxc-devel mailing list