render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c1c534
From 7207faf95b38811cbf0d19df02066cc06a138822 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <7207faf95b38811cbf0d19df02066cc06a138822@dist-git>
c1c534
From: Michal Privoznik <mprivozn@redhat.com>
c1c534
Date: Thu, 9 Nov 2017 16:06:46 +0100
c1c534
Subject: [PATCH] qemu: Destroy whole memory tree
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1461214
c1c534
c1c534
When removing path where huge pages are call virFileDeleteTree
c1c534
instead of plain rmdir(). The reason is that in the near future
c1c534
there's going to be more in the path than just files - some
c1c534
subdirs. Therefore plain rmdir() is not going to be enough.
c1c534
c1c534
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c1c534
Reviewed-by: John Ferlan <jferlan@redhat.com>
c1c534
(cherry picked from commit bb3de478a66edafd130ecca9a45a4d506ca727a0)
c1c534
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_process.c | 6 ++----
c1c534
 1 file changed, 2 insertions(+), 4 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
c1c534
index 605f280d0c..3324cc61f1 100644
c1c534
--- a/src/qemu/qemu_process.c
c1c534
+++ b/src/qemu/qemu_process.c
c1c534
@@ -3348,10 +3348,8 @@ qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver,
c1c534
             return -1;
c1c534
         }
c1c534
     } else {
c1c534
-        if (rmdir(path) < 0 &&
c1c534
-            errno != ENOENT)
c1c534
-            VIR_WARN("Unable to remove hugepage path: %s (errno=%d)",
c1c534
-                     path, errno);
c1c534
+        if (virFileDeleteTree(path) < 0)
c1c534
+            return -1;
c1c534
     }
c1c534
 
c1c534
     return 0;
c1c534
-- 
c1c534
2.15.0
c1c534