[lxc-devel] [lxc/master] cgroup.c: Check cgroup.use in is_crucial_cgroup_subsystem

marcosps on Github lxc-bot at linuxcontainers.org
Thu Feb 8 02:07:19 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 381 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180208/ef5ac210/attachment.bin>
-------------- next part --------------
From 566f3a315300ac69672fcf8065cc57bdc7c2bfda Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date: Wed, 7 Feb 2018 23:55:13 -0200
Subject: [PATCH] cgroup.c: Check cgroup.use in is_crucial_cgroup_subsystem

Fixes: #870

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
---
 src/lxc/cgroups/cgroup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c
index 1f78a6317..5491d5c0e 100644
--- a/src/lxc/cgroups/cgroup.c
+++ b/src/lxc/cgroups/cgroup.c
@@ -26,6 +26,7 @@
 
 #include "cgroup.h"
 #include "conf.h"
+#include "initutils.h"
 #include "log.h"
 #include "start.h"
 
@@ -246,9 +247,14 @@ void prune_init_scope(char *cg)
  * is not mounted then it will be ignored. But if systemd is mounted, then it
  * must be setup so that lxc can create cgroups in it, else containers will
  * fail.
+ *
+ * cgroups listed in lxc.cgroup.use are also treated as crucial
+ *
  */
 bool is_crucial_cgroup_subsystem(const char *s)
 {
+	const char *cgroup_use;
+
 	if (strcmp(s, "systemd") == 0)
 		return true;
 
@@ -258,5 +264,9 @@ bool is_crucial_cgroup_subsystem(const char *s)
 	if (strcmp(s, "freezer") == 0)
 		return true;
 
+	cgroup_use = lxc_global_config_value("lxc.cgroup.use");
+	if (cgroup_use && strstr(cgroup_use, s))
+		return true;
+
 	return false;
 }


More information about the lxc-devel mailing list