Commit 92b7a08d authored by Peter Lieven's avatar Peter Lieven Committed by Kevin Wolf
Browse files

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: default avatarPeter Lieven <pl@kamp.de>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 5c916681
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;