From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfhHE-0006vm-TQ for qemu-devel@nongnu.org; Fri, 02 Sep 2016 01:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfhHE-0002M5-0c for qemu-devel@nongnu.org; Fri, 02 Sep 2016 01:44:32 -0400 From: Markus Armbruster References: <1472767012-7641-1-git-send-email-jsnow@redhat.com> <1472767012-7641-2-git-send-email-jsnow@redhat.com> Date: Fri, 02 Sep 2016 07:44:20 +0200 In-Reply-To: <1472767012-7641-2-git-send-email-jsnow@redhat.com> (John Snow's message of "Thu, 1 Sep 2016 17:56:52 -0400") Message-ID: <87twdyg8jv.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 1/1] block-backend: allow flush on devices with open tray List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: qemu-block@nongnu.org, kwolf@redhat.com, mreitz@redhat.com, qemu-devel@nongnu.org, qemu-stable@nongnu.org John Snow writes: > 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 > --- > block/block-backend.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/block/block-backend.c b/block/block-backend.c > index effa038..36a32c3 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -1058,7 +1058,7 @@ BlockAIOCB *blk_aio_pwritev(BlockBackend *blk, int64_t offset, > BlockAIOCB *blk_aio_flush(BlockBackend *blk, > BlockCompletionFunc *cb, void *opaque) > { > - if (!blk_is_available(blk)) { > + if (!blk_is_inserted(blk)) { > return blk_abort_aio_request(blk, cb, opaque, -ENOMEDIUM); > } > > @@ -1118,7 +1118,7 @@ int blk_co_pdiscard(BlockBackend *blk, int64_t offset, int count) > > int blk_co_flush(BlockBackend *blk) > { > - if (!blk_is_available(blk)) { > + if (!blk_is_inserted(blk)) { > return -ENOMEDIUM; > } > > @@ -1127,7 +1127,7 @@ int blk_co_flush(BlockBackend *blk) > > int blk_flush(BlockBackend *blk) > { > - if (!blk_is_available(blk)) { > + if (!blk_is_inserted(blk)) { > return -ENOMEDIUM; > } Naive question: should we flush before we open the tray?