Pablo Greco 40546a
From ddea95c1c2e32c6454c89aa83d78b26a83564cd4 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <ddea95c1c2e32c6454c89aa83d78b26a83564cd4@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 1 Jul 2019 17:07:11 +0200
Pablo Greco 40546a
Subject: [PATCH] Revert "vircgroup: cleanup controllers not managed by systemd
Pablo Greco 40546a
 on error"
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
This reverts commit 1602aa28f820ada66f707cef3e536e8572fbda1e.
Pablo Greco 40546a
Pablo Greco 40546a
There is no need to call virCgroupRemove() nor virCgroupFree() if
Pablo Greco 40546a
virCgroupEnableMissingControllers() fails because it will not modify
Pablo Greco 40546a
'group' at all.
Pablo Greco 40546a
Pablo Greco 40546a
The cleanup of directories is done in virCgroupMakeGroup().
Pablo Greco 40546a
Pablo Greco 40546a
Reviewed-by: John Ferlan <jferlan@redhat.com>
Pablo Greco 40546a
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Pablo Greco 40546a
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
(cherry picked from commit 199eee6aae7af3d813fbe98660c7e0fa1a8ae7b7)
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <53288dd310e0305ac3179693e64684eb8b3a31ab.1561993100.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/vircgroup.c | 25 ++++++++++---------------
Pablo Greco 40546a
 1 file changed, 10 insertions(+), 15 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
Pablo Greco 40546a
index a376b9b89a..7ec1399bc6 100644
Pablo Greco 40546a
--- a/src/util/vircgroup.c
Pablo Greco 40546a
+++ b/src/util/vircgroup.c
Pablo Greco 40546a
@@ -1059,7 +1059,6 @@ virCgroupNewMachineSystemd(const char *name,
Pablo Greco 40546a
     int rv;
Pablo Greco 40546a
     virCgroupPtr init;
Pablo Greco 40546a
     VIR_AUTOFREE(char *) path = NULL;
Pablo Greco 40546a
-    virErrorPtr saved = NULL;
Pablo Greco 40546a
 
Pablo Greco 40546a
     VIR_DEBUG("Trying to setup machine '%s' via systemd", name);
Pablo Greco 40546a
     if ((rv = virSystemdCreateMachine(name,
Pablo Greco 40546a
@@ -1092,24 +1091,20 @@ virCgroupNewMachineSystemd(const char *name,
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (virCgroupEnableMissingControllers(path, pidleader,
Pablo Greco 40546a
                                           controllers, group) < 0) {
Pablo Greco 40546a
-        goto error;
Pablo Greco 40546a
+        return -1;
Pablo Greco 40546a
     }
Pablo Greco 40546a
 
Pablo Greco 40546a
-    if (virCgroupAddProcess(*group, pidleader) < 0)
Pablo Greco 40546a
-        goto error;
Pablo Greco 40546a
+    if (virCgroupAddProcess(*group, pidleader) < 0) {
Pablo Greco 40546a
+        virErrorPtr saved = virSaveLastError();
Pablo Greco 40546a
+        virCgroupRemove(*group);
Pablo Greco 40546a
+        virCgroupFree(group);
Pablo Greco 40546a
+        if (saved) {
Pablo Greco 40546a
+            virSetError(saved);
Pablo Greco 40546a
+            virFreeError(saved);
Pablo Greco 40546a
+        }
Pablo Greco 40546a
+    }
Pablo Greco 40546a
 
Pablo Greco 40546a
     return 0;
Pablo Greco 40546a
-
Pablo Greco 40546a
- error:
Pablo Greco 40546a
-    saved = virSaveLastError();
Pablo Greco 40546a
-    virCgroupRemove(*group);
Pablo Greco 40546a
-    virCgroupFree(group);
Pablo Greco 40546a
-    if (saved) {
Pablo Greco 40546a
-        virSetError(saved);
Pablo Greco 40546a
-        virFreeError(saved);
Pablo Greco 40546a
-    }
Pablo Greco 40546a
-
Pablo Greco 40546a
-    return -1;
Pablo Greco 40546a
 }
Pablo Greco 40546a
 
Pablo Greco 40546a
 
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a