From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEzbf-0003tC-Dt for qemu-devel@nongnu.org; Mon, 11 Mar 2013 06:05:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEzbY-0000id-J7 for qemu-devel@nongnu.org; Mon, 11 Mar 2013 06:05:23 -0400 Received: from ssl.dlhnet.de ([91.198.192.8]:34650 helo=ssl.dlh.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEzbY-0000i2-DS for qemu-devel@nongnu.org; Mon, 11 Mar 2013 06:05:16 -0400 Message-ID: <513DAC5B.5000607@dlhnet.de> Date: Mon, 11 Mar 2013 11:05:15 +0100 From: Peter Lieven MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [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: "qemu-devel@nongnu.org" Cc: Kevin Wolf , Paolo Bonzini , Jeff Cody , Anthony Liguori 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; } -- 1.7.9.5