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