From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: John Snow <jsnow@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block-backend: allow flush on devices with open tray
Date: Wed, 15 Jun 2016 09:51:08 +0200 [thread overview]
Message-ID: <20160615075108.GB4566@noname.redhat.com> (raw)
In-Reply-To: <9058ee75-0e95-a35f-4ab1-ca801baafa96@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3239 bytes --]
Am 14.06.2016 um 18:13 hat Max Reitz geschrieben:
> On 14.06.2016 17:54, John Snow wrote:
> >
> >
> > On 06/14/2016 09:19 AM, Max Reitz wrote:
> >> On 10.06.2016 23:59, John Snow wrote:
> >>> If a device still has an attached BDS because the medium has not yet
> >>> been removed, we will be unable to migrate to a new host because
> >>> blk_flush will return an error for that backend.
> >>>
> >>> Replace the call to blk_is_available to blk_is_inserted to weaken
> >>> the check and allow flushes from the backend to work, while still
> >>> disallowing flushes from the frontend/device model to work.
> >>>
> >>> This fixes a regression present in 2.6.0 caused by the following commit:
> >>> fe1a9cbc339bb54d20f1ca4c1e8788d16944d5cf
> >>> block: Move some bdrv_*_all() functions to BB
> >>>
> >>> Signed-off-by: John Snow <jsnow@redhat.com>
> >>> ---
> >>> block/block-backend.c | 2 +-
> >>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> I'm still not sure we shouldn't do the same for blk_{co,aio}_flush(). I
> >> guess you exclude them here because you specifically want to fix the
> >> issue mentioned in the commit message, but then we could just make
> >> blk_flush_all() ignore an -ENOMEDIUM.
> >
> > Yeah, I didn't investigate the full path. Just making the minimal fixes.
> > Is there a concern that this may still leave certain pathways broken
> > when the CDROM tray is open?
> >
> > I don't know of any immediately without digging again.
> >
> >>
> >> I personally think we should make all blk_*flush() functions use
> >> blk_is_inserted() instead of blk_is_available(). As we have discussed on
> >> IRC, there are probably not that many cases a guest can flush a medium
> >> in an open tray anyway (because the main use case are read-only
> >> CD-ROMs), and even if so, that wouldn't change any data, so even if the
> >> guest can actually flush something on an open tray, I don't think anyone
> >> would complain.
> >>
> >> Max
> >>
> >
> > I have difficulty making pragmatic arguments when purity is at stake,
> > but I've already wandered outside of my device model, so I will defer to
> > your judgment.
> >
> >>> diff --git a/block/block-backend.c b/block/block-backend.c
> >>> index 34500e6..d1e875e 100644
> >>> --- a/block/block-backend.c
> >>> +++ b/block/block-backend.c
> >>> @@ -1122,7 +1122,7 @@ int blk_co_flush(BlockBackend *blk)
> >>>
> >>> int blk_flush(BlockBackend *blk)
> >>> {
> >>> - if (!blk_is_available(blk)) {
> >>> + if (!blk_is_inserted(blk)) {
> >>> return -ENOMEDIUM;
> >>> }
> >>>
> >>>
> >>
> >>
> >
> > Is this a NACK unless I attempt to address the wider design issue?
>
> I just don't see a point in using blk_is_inserted() here but
> blk_is_available() in the other blk_*flush() functions. If
> blk_is_inserted() is correct for blk_flush(), it should be correct for
> blk_co_flush() and blk_aio_flush(), too.
I agree, if we can, we should keep the behaviour consistent between all
interfaces types (sync/AIO/coroutine, byte-based/sector-based) for the
same operation.
Eric also rightfully said that we need a test cases, so a v2 would be
good anyway.
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2016-06-15 7:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 21:59 [Qemu-devel] [PATCH] block-backend: allow flush on devices with open tray John Snow
2016-06-10 22:42 ` Eric Blake
2016-06-13 17:57 ` John Snow
2016-06-12 2:26 ` Fam Zheng
2016-06-14 13:19 ` Max Reitz
2016-06-14 15:54 ` John Snow
2016-06-14 16:13 ` Max Reitz
2016-06-15 7:51 ` Kevin Wolf [this message]
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=20160615075108.GB4566@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).