[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for 2.1 1/2] block: check for RESIZE blocker in the
From: |
Jeff Cody |
Subject: |
[Qemu-devel] [PATCH for 2.1 1/2] block: check for RESIZE blocker in the QMP command, not bdrv_truncate() |
Date: |
Wed, 25 Jun 2014 16:55:30 -0400 |
If we check for the RESIZE blocker in bdrv_truncate(), that means a
commit will fail if the overlay layer is larger than the base, due to
the backing blocker.
This is a regression in behavior from 2.0; currently, commit will try to
grow the size of the base image to match the overlay size, if the
overlay size is larger.
By moving this into the QMP command qmp_block_resize(), it allows
usage of bdrv_truncate() within block jobs.
Signed-off-by: Jeff Cody <address@hidden>
---
block.c | 4 +---
blockdev.c | 5 +++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 6d7901e..6f1380e 100644
--- a/block.c
+++ b/block.c
@@ -3498,9 +3498,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 80bae9d..dc535bf 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();
--
1.9.3