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 <[email protected]>
> ---
>  hw/block/fdc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Max Reitz <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to