qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-4.1 1/2] fdc: Fix inserting read-only media


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH for-4.1 1/2] fdc: Fix inserting read-only media in empty drive
Date: Tue, 30 Jul 2019 17:17:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 30.07.19 16:57, Kevin Wolf wrote:
> In order to insert a read-only medium (i.e. a read-only block node) to
> the BlockBackend of a floppy drive, we must not have taken write
> permissions on that BlockBackend, or the operation will fail with the
> error message "Block node is read-only".
> 
> The device already takes care to remove all permissions when the medium
> is ejected, but the state isn't correct if the drive is initially empty:
> It uses blk_is_read_only() to check whether write permissions should be
> taken, but this function returns false for empty BlockBackends in the
> common case.
> 
> Fix floppy_drive_realize() to avoid taking write permissions if the
> drive is empty.

...and once the drive is loaded with anything, fd_change_cb() calls
blkconf_apply_backend_option() again with the updated RO state.  Looks
correct.

> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  hw/block/fdc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Max Reitz <address@hidden>

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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