[libvirt] [PATCH 7/7] qemu: qemuOpenFileAs - set flag VIR_FILE_OPEN_FORCE_MODE

Eric Blake eblake at redhat.com
Thu Jan 29 20:30:53 UTC 2015


On 01/28/2015 03:25 PM, John Ferlan wrote:
> In the event we're falling into the code that tries to create the file
> in a forked environment (VIR_FILE_OPEN_FORK) we pass different mode bits,
> but those are never set because the virFileOpenForceOwnerMode has a check
> if the OPEN_FORCE_MODE bit is set before attempting to change the mode.
> 
> Since this is a special case it seems reasonable to set u+rw,g+rw,o
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_driver.c | 3 +++
>  1 file changed, 3 insertions(+)

I'd feel better with more testing before we take this one; Laine is more
familiar with testing root-squash setups.

> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 91fefa9..651f84b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2965,6 +2965,9 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
>  
>              /* Retry creating the file as qemu user */
>  
> +            /* Since we're passing different modes... */
> +            vfoflags |= VIR_FILE_OPEN_FORCE_MODE;
> +
>              if ((fd = virFileOpenAs(path, oflags,
>                                      S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP,
>                                      fallback_uid, fallback_gid,
> 

-- 
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/adca18c5/attachment-0001.sig>


More information about the libvir-list mailing list