From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrSEF-0004FL-9f for qemu-devel@nongnu.org; Wed, 28 Oct 2015 11:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrSEA-0003Cw-KG for qemu-devel@nongnu.org; Wed, 28 Oct 2015 11:01:31 -0400 From: "Denis V. Lunev" Date: Wed, 28 Oct 2015 18:01:04 +0300 Message-Id: <1446044465-19312-4-git-send-email-den@openvz.org> In-Reply-To: <1446044465-19312-1-git-send-email-den@openvz.org> References: <1446044465-19312-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 3/4] io: add locking constraints check into bdrv_drain to ensure locking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Denis V. Lunev" , Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi , qemu-stable@nongnu.org as described in the comment of the function Signed-off-by: Denis V. Lunev CC: Stefan Hajnoczi CC: Paolo Bonzini --- block/io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 5ac6256..2e98d45 100644 --- a/block/io.c +++ b/block/io.c @@ -247,12 +247,15 @@ bool bdrv_requests_pending(BlockDriverState *bs) void bdrv_drain(BlockDriverState *bs) { bool busy = true; + AioContext *aio_context = bdrv_get_aio_context(bs); + + assert(aio_context_is_locked(aio_context)); while (busy) { /* Keep iterating */ bdrv_flush_io_queue(bs); busy = bdrv_requests_pending(bs); - busy |= aio_poll(bdrv_get_aio_context(bs), busy); + busy |= aio_poll(aio_context, busy); } } -- 2.1.4