render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c480ed
From 2395bf301cf76ffa863a3c2e125d52345cfbf6b5 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <2395bf301cf76ffa863a3c2e125d52345cfbf6b5@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:08:23 +0200
c480ed
Subject: [PATCH] Revert "util: vircgroup: pass parent cgroup into
c480ed
 virCgroupDetectControllersCB"
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
This reverts commit 7bca1c9bdc85247446129f856e27c80a32819e17.
c480ed
c480ed
As it turns out it's not a good idea on systemd hosts.  The root
c480ed
cgroup can have all controllers enabled but they don't have to be
c480ed
enabled for sub-cgroups.
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
(cherry picked from commit d117431143d5b6dcfc8fae4a6b3fae23881d0937)
c480ed
c480ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Message-Id: <754b0ac5a0f1bd21e79eaeb71f6d2ab811446168.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroup.c        |  2 +-
c480ed
 src/util/vircgroupbackend.h |  3 +--
c480ed
 src/util/vircgroupv1.c      |  3 +--
c480ed
 src/util/vircgroupv2.c      | 17 ++++++-----------
c480ed
 4 files changed, 9 insertions(+), 16 deletions(-)
c480ed
c480ed
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
c480ed
index ff2a0b75b5..a7fb595bce 100644
c480ed
--- a/src/util/vircgroup.c
c480ed
+++ b/src/util/vircgroup.c
c480ed
@@ -412,7 +412,7 @@ virCgroupDetect(virCgroupPtr group,
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
c480ed
         if (group->backends[i]) {
c480ed
-            int rc = group->backends[i]->detectControllers(group, controllers, parent);
c480ed
+            int rc = group->backends[i]->detectControllers(group, controllers);
c480ed
             if (rc < 0)
c480ed
                 return -1;
c480ed
             controllersAvailable |= rc;
c480ed
diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h
c480ed
index 05af118ec1..a825dc4be7 100644
c480ed
--- a/src/util/vircgroupbackend.h
c480ed
+++ b/src/util/vircgroupbackend.h
c480ed
@@ -96,8 +96,7 @@ typedef char *
c480ed
 
c480ed
 typedef int
c480ed
 (*virCgroupDetectControllersCB)(virCgroupPtr group,
c480ed
-                                int controllers,
c480ed
-                                virCgroupPtr parent);
c480ed
+                                int controllers);
c480ed
 
c480ed
 typedef bool
c480ed
 (*virCgroupHasControllerCB)(virCgroupPtr cgroup,
c480ed
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
c480ed
index 5b218c7f78..58bd20d636 100644
c480ed
--- a/src/util/vircgroupv1.c
c480ed
+++ b/src/util/vircgroupv1.c
c480ed
@@ -419,8 +419,7 @@ virCgroupV1StealPlacement(virCgroupPtr group)
c480ed
 
c480ed
 static int
c480ed
 virCgroupV1DetectControllers(virCgroupPtr group,
c480ed
-                             int controllers,
c480ed
-                             virCgroupPtr parent ATTRIBUTE_UNUSED)
c480ed
+                             int controllers)
c480ed
 {
c480ed
     size_t i;
c480ed
     size_t j;
c480ed
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
c480ed
index bdeab397a3..b0ed889cc8 100644
c480ed
--- a/src/util/vircgroupv2.c
c480ed
+++ b/src/util/vircgroupv2.c
c480ed
@@ -285,21 +285,16 @@ virCgroupV2ParseControllersFile(virCgroupPtr group)
c480ed
 
c480ed
 static int
c480ed
 virCgroupV2DetectControllers(virCgroupPtr group,
c480ed
-                             int controllers,
c480ed
-                             virCgroupPtr parent)
c480ed
+                             int controllers)
c480ed
 {
c480ed
     size_t i;
c480ed
 
c480ed
-    if (parent) {
c480ed
-        group->unified.controllers = parent->unified.controllers;
c480ed
-    } else {
c480ed
-        if (virCgroupV2ParseControllersFile(group) < 0)
c480ed
-            return -1;
c480ed
+    if (virCgroupV2ParseControllersFile(group) < 0)
c480ed
+        return -1;
c480ed
 
c480ed
-        /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
c480ed
-         * exists with usage stats. */
c480ed
-        group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
c480ed
-    }
c480ed
+    /* In cgroup v2 there is no cpuacct controller, the cpu.stat file always
c480ed
+     * exists with usage stats. */
c480ed
+    group->unified.controllers |= 1 << VIR_CGROUP_CONTROLLER_CPUACCT;
c480ed
 
c480ed
     if (controllers >= 0)
c480ed
         group->unified.controllers &= controllers;
c480ed
-- 
c480ed
2.22.0
c480ed