[libvirt] [PATCH 6/7] qemu: remove failed create prior to root squash share path
Eric Blake
eblake at redhat.com
Thu Jan 29 20:29:57 UTC 2015
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 at redhat.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150129/6229b501/attachment-0001.sig>
More information about the libvir-list
mailing list