[libvirt PATCH 12/15] cgroup: return directly if there is nothing to remove

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Apr 6 21:27:09 UTC 2020


From: Marc-André Lureau <marcandre.lureau at redhat.com>

This fixes an error path when virCgroupV2DevicesDetectProg() fails but
wasn't needed in the first place on VM shutdown.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/util/vircgroupv2devices.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c
index d62ee12a05..997ef82964 100644
--- a/src/util/vircgroupv2devices.c
+++ b/src/util/vircgroupv2devices.c
@@ -541,12 +541,13 @@ virCgroupV2DevicesPrepareProg(virCgroupPtr group)
 int
 virCgroupV2DevicesRemoveProg(virCgroupPtr group)
 {
-    if (virCgroupV2DevicesDetectProg(group) < 0)
-        return -1;
-
     if (group->unified.devices.progfd <= 0 && group->unified.devices.mapfd <= 0)
         return 0;
 
+    if (virCgroupV2DevicesDetectProg(group) < 0) {
+        return -1;
+    }
+
     if (group->unified.devices.mapfd >= 0)
         VIR_FORCE_CLOSE(group->unified.devices.mapfd);
 
-- 
2.26.0.rc2.42.g98cedd0233




More information about the libvir-list mailing list