|
Pablo Greco |
40546a |
From 9831bda48172881b14f3c473b625ce5ddbd04300 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <9831bda48172881b14f3c473b625ce5ddbd04300@dist-git>
|
|
Pablo Greco |
40546a |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Mon, 1 Jul 2019 17:06:08 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] vircgroup: Call virCgroupRemove inside virCgroupMakeGroup
|
|
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 fixes virCgroupEnableMissingControllers where virCgroupRemove
|
|
Pablo Greco |
40546a |
was not called in case virCgroupMakeGroup failed.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit b013bdfd797489e6c254917da299842fe051d058)
|
|
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: <09accbd84f3da1d7c6682357cf6c9a720631a247.1561993099.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 | 18 +++++++++---------
|
|
Pablo Greco |
40546a |
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
index 8646a4a479..dde9ed21a2 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/vircgroup.c
|
|
Pablo Greco |
40546a |
@@ -1052,7 +1052,7 @@ virCgroupMakeGroup(virCgroupPtr parent,
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
if (virCgroupPathOfController(group, i, "", &path) < 0)
|
|
Pablo Greco |
40546a |
- return -1;
|
|
Pablo Greco |
40546a |
+ goto error;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
/* As of Feb 2011, clang can't see that the above function
|
|
Pablo Greco |
40546a |
* call did not modify group. */
|
|
Pablo Greco |
40546a |
@@ -1076,7 +1076,7 @@ virCgroupMakeGroup(virCgroupPtr parent,
|
|
Pablo Greco |
40546a |
virReportSystemError(errno,
|
|
Pablo Greco |
40546a |
_("Failed to create controller %s for group"),
|
|
Pablo Greco |
40546a |
virCgroupControllerTypeToString(i));
|
|
Pablo Greco |
40546a |
- return -1;
|
|
Pablo Greco |
40546a |
+ goto error;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL &&
|
|
Pablo Greco |
40546a |
@@ -1084,7 +1084,7 @@ virCgroupMakeGroup(virCgroupPtr parent,
|
|
Pablo Greco |
40546a |
STREQ(group->controllers[i].mountPoint,
|
|
Pablo Greco |
40546a |
group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) {
|
|
Pablo Greco |
40546a |
if (virCgroupCpuSetInherit(parent, group) < 0)
|
|
Pablo Greco |
40546a |
- return -1;
|
|
Pablo Greco |
40546a |
+ goto error;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
/*
|
|
Pablo Greco |
40546a |
* Note that virCgroupSetMemoryUseHierarchy should always be
|
|
Pablo Greco |
40546a |
@@ -1096,13 +1096,17 @@ virCgroupMakeGroup(virCgroupPtr parent,
|
|
Pablo Greco |
40546a |
STREQ(group->controllers[i].mountPoint,
|
|
Pablo Greco |
40546a |
group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint))) {
|
|
Pablo Greco |
40546a |
if (virCgroupSetMemoryUseHierarchy(group) < 0)
|
|
Pablo Greco |
40546a |
- return -1;
|
|
Pablo Greco |
40546a |
+ goto error;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
VIR_DEBUG("Done making controllers for group");
|
|
Pablo Greco |
40546a |
return 0;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ error:
|
|
Pablo Greco |
40546a |
+ virCgroupRemove(group);
|
|
Pablo Greco |
40546a |
+ return -1;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
@@ -1316,10 +1320,8 @@ virCgroupNewPartition(const char *path,
|
|
Pablo Greco |
40546a |
if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0)
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_NONE) < 0) {
|
|
Pablo Greco |
40546a |
- virCgroupRemove(*group);
|
|
Pablo Greco |
40546a |
+ if (virCgroupMakeGroup(parent, *group, create, VIR_CGROUP_NONE) < 0)
|
|
Pablo Greco |
40546a |
goto cleanup;
|
|
Pablo Greco |
40546a |
- }
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
ret = 0;
|
|
Pablo Greco |
40546a |
@@ -1389,7 +1391,6 @@ virCgroupNewDomainPartition(virCgroupPtr partition,
|
|
Pablo Greco |
40546a |
*/
|
|
Pablo Greco |
40546a |
if (virCgroupMakeGroup(partition, *group, create,
|
|
Pablo Greco |
40546a |
VIR_CGROUP_MEM_HIERACHY) < 0) {
|
|
Pablo Greco |
40546a |
- virCgroupRemove(*group);
|
|
Pablo Greco |
40546a |
virCgroupFree(group);
|
|
Pablo Greco |
40546a |
return -1;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
@@ -1446,7 +1447,6 @@ virCgroupNewThread(virCgroupPtr domain,
|
|
Pablo Greco |
40546a |
return -1;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
if (virCgroupMakeGroup(domain, *group, create, VIR_CGROUP_NONE) < 0) {
|
|
Pablo Greco |
40546a |
- virCgroupRemove(*group);
|
|
Pablo Greco |
40546a |
virCgroupFree(group);
|
|
Pablo Greco |
40546a |
return -1;
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|