From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFi2T-00026U-9v for qemu-devel@nongnu.org; Wed, 13 Mar 2013 05:32:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFi2N-0005mA-8E for qemu-devel@nongnu.org; Wed, 13 Mar 2013 05:32:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFi2M-0005m6-W3 for qemu-devel@nongnu.org; Wed, 13 Mar 2013 05:31:55 -0400 Date: Wed, 13 Mar 2013 10:31:46 +0100 From: Kevin Wolf Message-ID: <20130313093145.GB2309@dhcp-200-207.str.redhat.com> References: <513DAC5B.5000607@dlhnet.de> <513DAF15.4030000@redhat.com> <74DFB48B-A0B9-49CF-AD04-477BFA275845@dlhnet.de> <513DC3AF.8030104@redhat.com> <513DC561.7080802@dlhnet.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <513DC561.7080802@dlhnet.de> Subject: Re: [Qemu-devel] [PATCH 3/3] iscsi_truncate: ensure there are no requests in flight List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: Paolo Bonzini , Jeff Cody , "qemu-devel@nongnu.org" , Anthony Liguori Am 11.03.2013 um 12:52 hat Peter Lieven geschrieben: > On 11.03.2013 12:44, Paolo Bonzini wrote: > >Il 11/03/2013 11:19, Peter Lieven ha scritto: > >> > >>Am 11.03.2013 um 11:16 schrieb Paolo Bonzini : > >> > >>>Il 11/03/2013 11:05, Peter Lieven ha scritto: > >>>>ensure that there are no pending I/Os before calling > >>>>the sync readcapacity commands. the block_resize monitor > >>>>command will also flush all I/O, but double check in > >>>>case iscsi_truncate() is called from elsewhere in the > >>>>future. > >>>> > >>>>Signed-off-by: Peter Lieven > >>>>--- > >>>>block/iscsi.c | 4 ++++ > >>>>1 file changed, 4 insertions(+) > >>>> > >>>>diff --git a/block/iscsi.c b/block/iscsi.c > >>>>index 3d52921..de20d53 100644 > >>>>--- a/block/iscsi.c > >>>>+++ b/block/iscsi.c > >>>>@@ -1167,6 +1167,10 @@ static int iscsi_truncate(BlockDriverState *bs, > >>>>int64_t offset) > >>>> return -ENOTSUP; > >>>> } > >>>> > >>>>+ /* ensure all async requests are completed before executing > >>>>+ * a sync readcapacity */ > >>>>+ bdrv_drain_all(); > >>>>+ > >>>> if ((ret = iscsi_readcapacity_sync(iscsilun)) != 0) { > >>>> return ret; > >>>> } > >>> > >>>NACK to this patch. It would be a bug, let's fix it properly. > >> > >>ok, are you sure that never ever will some new feature call bdrv_truncate() on an iscsi > >>device? > > > >I'm sure some new feature _will_ call bdrv_truncate(). But as things > >stand now, it would be a bug to do so on an iSCSI device. > > > >For example, qcow1 (and VHDX) will already call it, but that's a bug and > >should be fixed otherwise. Your patch will just cause an assertion failure. > > In which case can qcow1 (and VHDX) be used in conjunction with an iSCSI Target? > > Would it be ok for you to assert if iscsi_truncate() is called when there > are aio's in flight? How can this be checked? > > I just want to make sure that nothing nasty happens in that case (such as > nested event loops). Isn't the real problem that I/O requests for _this_specific_ iscsi BDS must not be in flight? So what you reall need is bdrv_drain(iscsi_bs)? If I understand the code correctly, this boils down to: while (iscsi_process_flush(iscsilun)) { qemu_aio_wait(); } Kevin