[PATCH] util: change the return value of virCgroupRemove if failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virCgroupRemove return -1 when removing cgroup failed.
But there are retry code to remove cgroup in QemuProcessStop:

 retry:
    if ((ret = qemuRemoveCgroup(vm)) < 0) {
        if (ret == -EBUSY && (retries++ < 5)) {
            usleep(200*1000);
            goto retry;
        }
        VIR_WARN("Failed to remove cgroup for %s",
                 vm->def->name);
    }

The return value of qemuRemoveCgroup will never be equal to "-EBUSY",
so change the return value of virCgroupRemove if failed.

Signed-off-by: Wang Yechao <wang.yechao255@xxxxxxxxxx>
---
 src/util/vircgroup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 268e401..260ed2d 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -2399,11 +2399,13 @@ int
 virCgroupRemove(virCgroupPtr group)
 {
     size_t i;
+    int ret = 0;
 
     for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
-        if (group->backends[i] &&
-            group->backends[i]->remove(group) < 0) {
-            return -1;
+        if (group->backends[i])
+            ret = group->backends[i]->remove(group);
+            if (ret < 0)
+                return ret;
         }
     }
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux