|
|
7711c0 |
From 33de34ca77050003d06f36c9228c6408312f4be0 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 6 Feb 2019 22:12:26 +0100
|
|
|
7711c0 |
Subject: [PATCH 16/33] dirty-bitmap: switch assert-fails to errors in
|
|
|
7711c0 |
bdrv_merge_dirty_bitmap
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190206221243.7407-7-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84263
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v2 06/23] dirty-bitmap: switch assert-fails to errors in bdrv_merge_dirty_bitmap
|
|
|
7711c0 |
Bugzilla: 1658343
|
|
|
7711c0 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Move checks from qmp_x_block_dirty_bitmap_merge() to
|
|
|
7711c0 |
bdrv_merge_dirty_bitmap(), to share them with dirty bitmap merge
|
|
|
7711c0 |
transaction action in future commit.
|
|
|
7711c0 |
|
|
|
7711c0 |
Note: for now, only qmp_x_block_dirty_bitmap_merge() calls
|
|
|
7711c0 |
bdrv_merge_dirty_bitmap().
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 06bf50068a7e952afff8c4f6470ec54a712570f7)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
block/dirty-bitmap.c | 15 +++++++++++++--
|
|
|
7711c0 |
blockdev.c | 10 ----------
|
|
|
7711c0 |
2 files changed, 13 insertions(+), 12 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
|
|
|
7711c0 |
index 59027d4..999a40c 100644
|
|
|
7711c0 |
--- a/block/dirty-bitmap.c
|
|
|
7711c0 |
+++ b/block/dirty-bitmap.c
|
|
|
7711c0 |
@@ -797,12 +797,23 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src,
|
|
|
7711c0 |
|
|
|
7711c0 |
qemu_mutex_lock(dest->mutex);
|
|
|
7711c0 |
|
|
|
7711c0 |
- assert(bdrv_dirty_bitmap_enabled(dest));
|
|
|
7711c0 |
- assert(!bdrv_dirty_bitmap_readonly(dest));
|
|
|
7711c0 |
+ if (bdrv_dirty_bitmap_frozen(dest)) {
|
|
|
7711c0 |
+ error_setg(errp, "Bitmap '%s' is frozen and cannot be modified",
|
|
|
7711c0 |
+ dest->name);
|
|
|
7711c0 |
+ goto out;
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ if (bdrv_dirty_bitmap_readonly(dest)) {
|
|
|
7711c0 |
+ error_setg(errp, "Bitmap '%s' is readonly and cannot be modified",
|
|
|
7711c0 |
+ dest->name);
|
|
|
7711c0 |
+ goto out;
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
|
|
|
7711c0 |
if (!hbitmap_merge(dest->bitmap, src->bitmap)) {
|
|
|
7711c0 |
error_setg(errp, "Bitmaps are incompatible and can't be merged");
|
|
|
7711c0 |
+ goto out;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
+out:
|
|
|
7711c0 |
qemu_mutex_unlock(dest->mutex);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
7711c0 |
index 745ed08..cef1bfe 100644
|
|
|
7711c0 |
--- a/blockdev.c
|
|
|
7711c0 |
+++ b/blockdev.c
|
|
|
7711c0 |
@@ -3113,16 +3113,6 @@ void qmp_x_block_dirty_bitmap_merge(const char *node, const char *dst_name,
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
- if (bdrv_dirty_bitmap_frozen(dst)) {
|
|
|
7711c0 |
- error_setg(errp, "Bitmap '%s' is frozen and cannot be modified",
|
|
|
7711c0 |
- dst_name);
|
|
|
7711c0 |
- return;
|
|
|
7711c0 |
- } else if (bdrv_dirty_bitmap_readonly(dst)) {
|
|
|
7711c0 |
- error_setg(errp, "Bitmap '%s' is readonly and cannot be modified",
|
|
|
7711c0 |
- dst_name);
|
|
|
7711c0 |
- return;
|
|
|
7711c0 |
- }
|
|
|
7711c0 |
-
|
|
|
7711c0 |
src = bdrv_find_dirty_bitmap(bs, src_name);
|
|
|
7711c0 |
if (!src) {
|
|
|
7711c0 |
error_setg(errp, "Dirty bitmap '%s' not found", src_name);
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|