Re: [PATCH 3/4] virFileOpenForked: Fix handling of return value from virSocketSendFD()

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

 



On Wed, May 22, 2024 at 18:00:18 +0200, Peter Krempa wrote:
> Commit 91f4ebbac81bc3829da6d5a71d7520a6fc9e358e (v10.0.0-185-g91f4ebbac8)
> changed the return value of virSocketSendFD() from 0 to 1 on success.
> 
> Unfortunately in 'virFileOpenForked' the return value was used to report
> the error back to the main process from the fork'd child. As process
> return codes are positive only, the code negates the value of 'ret' and
> reports it. This resulted in the parent thinking the process exited with
> failure:
> 
>  # virsh save avocado-vt-vm1 /mnt/save
>  error: Failed to save domain 'avocado-vt-vm1' to /mnt/save
>  error: Error from child process creating '/mnt/save': Unknown error 255
> 
> This error reproduces on NFS mounts with 'root_squash' enabled. I've
> also observed it in one specific migration case when root_squash NFS is
> used with following error:
> 
>   Failed to open file '/var/lib/libvirt/images/alpine.qcow2': Unknown error 255'
> 
> To fix the issue the code is refactored so that it doesn't actually
> touch the 'ret' variable needlessly and assigns to it only on failure
> cases, which prevents the '1' to be propagated to the parent process as
> '255' after negating and storing in the process return code.
> 
> Fixes: 91f4ebbac81bc3829da6d5a71d7520a6fc9e358e
> Resolves: https://issues.redhat.com/browse/RHEL-36721
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  src/util/virfile.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Reviewed-by: Jiri Denemark <jdenemar@xxxxxxxxxx>



[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