summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Lieven <pl@dlhnet.de>2013-03-11 11:04:24 +0100
committerMichael Roth <mdroth@linux.vnet.ibm.com>2013-04-04 17:36:43 -0500
commit2b92aa36d112780674d5686ad9c98e8cfe68d207 (patch)
tree942965201adafb831c608d6270baa886b309e672
parente4cce2d3e9dbdb1c82994f024c0c7e2d2661547e (diff)
downloadqemu-2b92aa36d112780674d5686ad9c98e8cfe68d207.tar.gz
block: complete all IOs before resizing a device
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>
-rw-r--r--blockdev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index 63e6f1eafa..4ea2725fce 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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;