render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 7207faf95b38811cbf0d19df02066cc06a138822 Mon Sep 17 00:00:00 2001
Message-Id: <7207faf95b38811cbf0d19df02066cc06a138822@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 9 Nov 2017 16:06:46 +0100
Subject: [PATCH] qemu: Destroy whole memory tree

https://bugzilla.redhat.com/show_bug.cgi?id=1461214

When removing path where huge pages are call virFileDeleteTree
instead of plain rmdir(). The reason is that in the near future
there's going to be more in the path than just files - some
subdirs. Therefore plain rmdir() is not going to be enough.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
(cherry picked from commit bb3de478a66edafd130ecca9a45a4d506ca727a0)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_process.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 605f280d0c..3324cc61f1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3348,10 +3348,8 @@ qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver,
             return -1;
         }
     } else {
-        if (rmdir(path) < 0 &&
-            errno != ENOENT)
-            VIR_WARN("Unable to remove hugepage path: %s (errno=%d)",
-                     path, errno);
+        if (virFileDeleteTree(path) < 0)
+            return -1;
     }
 
     return 0;
-- 
2.15.0