Re: [PATCH] Fix reporting of i/o errors by iohelper process

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

 



On 07/16/2014 08:12 AM, Jason J. Herne wrote:
> From: "Jason J. Herne" <jjherne@xxxxxxxxxx>
> 
> libvirt_iohelper is a helper process that is exec'ed and used to handle I/O
> during a Qemu managed save operation. Due to a missing call to
> virFileWrapperFdClose, all I/O error messages reported by iohelper are lost.
> 
> This patch adds a call to virFileWrapperFdClose to the cleanup phase of
> qemuDomainSaveMemory.
> 
> This patch also modifies virFileWrapperFdClose such that errors are only
> reported when the length of the err_msg buffer is > 0. Before now, the
> existence of the buffer would trigger error reporting in virFileWrapperFdClose.
> 
> Signed-off-by: Jason J. Herne <jjherne@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 1 +
>  src/util/virfile.c     | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)

Nice! Thanks for persevering on this one.  Congrats on your first
libvirt patch.

> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ecccf6c..8d78805 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3015,6 +3015,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
>  
>   cleanup:
>      VIR_FORCE_CLOSE(fd);
> +    virFileWrapperFdClose(wrapperFd);
>      virFileWrapperFdFree(wrapperFd);
>      VIR_FREE(xml);
>  
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index 463064c..813b4f5 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -322,7 +322,7 @@ virFileWrapperFdClose(virFileWrapperFdPtr wfd)
>          return 0;
>  
>      ret = virCommandWait(wfd->cmd, NULL);
> -    if (wfd->err_msg)
> +    if (wfd->err_msg && strlen(wfd->err_msg))

Micro-optimization: more efficient when written:

if (wfd->err_msg && *wfd->err_msg)

since then you don't have to waste time of crawling the entire string.

ACK based on looking at the code, and I'll push with that modification
once I've also tested it (or reply again if something turns up).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]