diff options
-rw-r--r-- | block.c | 4 | ||||
-rw-r--r-- | blockdev.c | 5 |
2 files changed, 6 insertions, 3 deletions
@@ -3483,9 +3483,7 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset) return -ENOTSUP; if (bs->read_only) return -EACCES; - if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { - return -EBUSY; - } + ret = drv->bdrv_truncate(bs, offset); if (ret == 0) { ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); diff --git a/blockdev.c b/blockdev.c index 03ab153d01..e8bfa3c660 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1819,6 +1819,11 @@ void qmp_block_resize(bool has_device, const char *device, return; } + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { + error_set(errp, QERR_DEVICE_IN_USE, device); + return; + } + /* complete all in-flight operations before resizing the device */ bdrv_drain_all(); |