aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorPeter Lieven <pl@dlhnet.de>2013-03-11 11:04:24 +0100
committerKevin Wolf <kwolf@redhat.com>2013-03-22 17:51:31 +0100
commit92b7a08d64e5e3129fa885f9d180e5bddcb76b42 (patch)
treea5d82d0be1107be81d8a7c3aa4f7d115356d18dc /blockdev.c
parent5c916681ae2383f0425bb8a3680ade9d055f5dfe (diff)
downloadqemu-92b7a08d64e5e3129fa885f9d180e5bddcb76b42.zip
qemu-92b7a08d64e5e3129fa885f9d180e5bddcb76b42.tar.gz
qemu-92b7a08d64e5e3129fa885f9d180e5bddcb76b42.tar.bz2
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>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c3
1 files changed, 3 insertions, 0 deletions
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;