[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 5/7] block: Error out on load_vm with active dirty bi
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 5/7] block: Error out on load_vm with active dirty bitmaps |
Date: |
Tue, 21 Nov 2017 16:10:15 +0100 |
Loading a snapshot invalidates the bitmap. Just marking all blocks dirty
is not a useful response in practice, instead the user needs to be aware
that we switch to a completely different state. If they are okay with
losing the dirty bitmap, they can just explicitly delete it.
This effectively reverts commit 04dec3c3ae5.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Denis V. Lunev <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: John Snow <address@hidden>
---
block/snapshot.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/block/snapshot.c b/block/snapshot.c
index 8585599579..8cb70dbad5 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -182,25 +182,16 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
{
BlockDriver *drv = bs->drv;
int ret, open_ret;
- int64_t len;
if (!drv) {
error_setg(errp, "Block driver is closed");
return -ENOMEDIUM;
}
- len = bdrv_getlength(bs);
- if (len < 0) {
- error_setg_errno(errp, -len, "Cannot get block device size");
- return len;
+ if (!QLIST_EMPTY(&bs->dirty_bitmaps)) {
+ error_setg(errp, "Device has active dirty bitmaps");
+ return -EBUSY;
}
- /* We should set all bits in all enabled dirty bitmaps, because dirty
- * bitmaps reflect active state of disk and snapshot switch operation
- * actually dirties active state.
- * TODO: It may make sense not to set all bits but analyze block status of
- * current state and destination snapshot and do not set bits corresponding
- * to both-zero or both-unallocated areas. */
- bdrv_set_dirty(bs, 0, len);
if (drv->bdrv_snapshot_goto) {
ret = drv->bdrv_snapshot_goto(bs, snapshot_id);
--
2.13.6
- [Qemu-devel] [PULL 0/7] Block layer patches for 2.11.0-rc2, Kevin Wolf, 2017/11/21
- [Qemu-devel] [PULL 1/7] block: Don't use BLK_PERM_CONSISTENT_READ for format probing, Kevin Wolf, 2017/11/21
- [Qemu-devel] [PULL 2/7] block: Don't request I/O permission with BDRV_O_NO_IO, Kevin Wolf, 2017/11/21
- [Qemu-devel] [PULL 4/7] block: Add errp to bdrv_all_goto_snapshot(), Kevin Wolf, 2017/11/21
- [Qemu-devel] [PULL 3/7] block: Add errp to bdrv_snapshot_goto(), Kevin Wolf, 2017/11/21
- [Qemu-devel] [PULL 6/7] block: Close a BlockDriverState completely even when bs->drv is NULL, Kevin Wolf, 2017/11/21
- [Qemu-devel] [PULL 5/7] block: Error out on load_vm with active dirty bitmaps,
Kevin Wolf <=
- [Qemu-devel] [PULL 7/7] iotests: Fix 176 on 32-bit host, Kevin Wolf, 2017/11/21
- Re: [Qemu-devel] [PULL 0/7] Block layer patches for 2.11.0-rc2, Peter Maydell, 2017/11/21