From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ5yK-0000bJ-KW for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:41:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJ5yG-0001LC-BZ for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:41:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ5y8-0001IY-FQ for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:41:39 -0400 From: Kevin Wolf Date: Fri, 22 Mar 2013 18:41:11 +0100 Message-Id: <1363974083-28440-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1363974083-28440-1-git-send-email-kwolf@redhat.com> References: <1363974083-28440-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 02/14] block: complete all IOs before resizing a device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Peter Lieven this patch ensures that all pending IOs are completed before a device is resized. this is especially important if a device is shrinked as it the bdrv_check_request() result is invalidated. Signed-off-by: Peter Lieven Signed-off-by: Kevin Wolf --- blockdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blockdev.c b/blockdev.c index 09f76b7..6f2b759 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1127,6 +1127,9 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp) return; } + /* complete all in-flight operations before resizing the device */ + bdrv_drain_all(); + switch (bdrv_truncate(bs, size)) { case 0: break; -- 1.8.1.4