On 11/07/2017 10:51 AM, Michal Privoznik wrote:
> 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>
> ---
> src/qemu/qemu_process.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index e27cd0d40..8eef2794e 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3348,7 +3348,7 @@ qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver,
> return -1;
> }
> } else {
> - if (rmdir(path) < 0 &&
> + if (virFileDeleteTree(path) < 0 &&
> errno != ENOENT)
> VIR_WARN("Unable to remove hugepage path: %s (errno=%d)",
> path, errno);
No way ENOENT could be returned here since virFileDeleteTree checks that
first...
Also virFileDeleteTree will emit a virReportSystemError on rmdir failure
(that also has an ENOENT check), plus any number of other checks.
Since this code path returns 0/success, then we should probably
"consume" the Last error message and splat it as the VIR_WARN message or
just decide to actually return an error here now.
John
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list