]> 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)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 4 Apr 2013 22:36:43 +0000 (17:36 -0500)
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>
(cherry picked from commit 92b7a08d64e5e3129fa885f9d180e5bddcb76b42)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
blockdev.c

index 63e6f1eafa81e3517767246a00bd695a6f3cf867..4ea2725fce12a4bcfcc775541feb0c65032111b0 100644 (file)
@@ -1043,6 +1043,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;