All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: jsnow@redhat.com, philmd@redhat.com, armbru@redhat.com,
	qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <f871b863-722a-c8d9-dbe7-6ed010e7d4e0@redhat.com> (raw)
In-Reply-To: <20190730145727.28965-2-kwolf@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 1056 bytes --]

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 <kwolf@redhat.com>
> ---
>  hw/block/fdc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-07-30 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 14:57 [Qemu-devel] [PATCH for-4.1 0/2] fdc: Fix inserting read-only media in empty drive Kevin Wolf
2019-07-30 14:57 ` [Qemu-devel] [PATCH for-4.1 1/2] " Kevin Wolf
2019-07-30 15:17   ` Max Reitz [this message]
2019-07-30 15:24   ` John Snow
2019-07-30 14:57 ` [Qemu-devel] [PATCH for-4.1 2/2] iotests/118: Test inserting a read-only medium Kevin Wolf
2019-07-30 15:24   ` Max Reitz
2019-07-30 15:25   ` John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f871b863-722a-c8d9-dbe7-6ed010e7d4e0@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.