Re: [PATCH 6/7] qemu: remove failed create prior to root squash share path

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

 



On 01/28/2015 03:25 PM, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1158034
> 
> In qemuOpenFileAs if we fall into the path where we'll be opening / creating
> the file using VIR_FILE_OPEN_FORK, we need to first unlink/delete the file
> we created in the first path; otherwise, the attempt by the child process
> to open as some specific user:group may fail because the file was already
> created using nfsnobody:nfsnobody.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Might be worth squashing with 5; up to you.

ACK.

> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 89b54c8..91fefa9 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2954,6 +2954,15 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
>                      goto error;
>              }
>  
> +            /* If we created the file above, then we need to remove it;
> +             * otherwise, the next attempt to create will fail. If the
> +             * file had already existed before we got here, then we also
> +             * don't want to delete it and allow the following to succeed
> +             * or fail based on existing protections
> +             */
> +            if (need_unlink)
> +                unlink(path);
> +
>              /* Retry creating the file as qemu user */
>  
>              if ((fd = virFileOpenAs(path, oflags,
> 

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