qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] block/vvfat: Fix ro shared folder


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] block/vvfat: Fix ro shared folder
Date: Tue, 31 Aug 2021 18:06:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Hi Guillaume,

On 8/31/21 4:17 PM, Guillaume Roche wrote:
> QEMU exits in error when passing a vfat shared folder in read-only mode.
> 
> To fix this issue, this patch removes any potential write permission
> from cumulative_perms, when a read-only block device is in use.
> 
> Buglink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=918950
> 
> Signed-off-by: Guillaume Roche <groche@genymobile.com>
> ---
> This is an attempt to fix this behavior, but it feels a bit hacky to me
> since this patch checks for the vvfat format in a generic function.

What about implementing bdrv_vvfat::bdrv_check_perm()?

> However, I'd be glad to have some advice to make it better. Anyway, I
> ran the block tests to ensure this does not introduce any regression.
> 
> To add some context: I know that this can be worked around by setting 
> the shared folder in rw mode. But our use-case requires using both
> shared and VM snapshots, and QEMU prevents using snapshot with a rw 
> shared folder.
> 
>  block.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/block.c b/block.c
> index e97ce0b1c8..3f59e3843f 100644
> --- a/block.c
> +++ b/block.c
> @@ -2383,6 +2383,12 @@ void bdrv_get_cumulative_perm(BlockDriverState *bs, 
> uint64_t *perm,
>          cumulative_shared_perms &= c->shared_perm;
>      }
>  
> +    /* Discard write permission if vvfat block device is read-only */
> +    const char *format = bdrv_get_format_name(bs);
> +    if (format != NULL && strncmp(format, "vvfat", 5) == 0 && 
> bdrv_is_read_only(bs)) {
> +        cumulative_perms &= ~BLK_PERM_WRITE;
> +    }
> +
>      *perm = cumulative_perms;
>      *shared_perm = cumulative_shared_perms;
>  }
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]