]> git.proxmox.com Git - qemu.git/commitdiff
block: complete all IOs before resizing a device
authorPeter Lieven <pl@dlhnet.de>
Mon, 11 Mar 2013 10:04:24 +0000 (11:04 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 22 Mar 2013 16:51:31 +0000 (17:51 +0100)
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 <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c

index 09f76b782f83945571ee84ccecd90d4ca33863ca..6f2b7592ce2b1b8dd2ef9e7fcc5306ec95e6e814 100644 (file)
@@ -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;