|
|
7711c0 |
From 6f65d2a9ee0258869d7420b2cf1b3890c7fcfef0 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 6 Feb 2019 22:12:34 +0100
|
|
|
7711c0 |
Subject: [PATCH 24/33] block/dirty-bitmaps: prohibit enable/disable on
|
|
|
7711c0 |
locked/frozen bitmaps
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190206221243.7407-15-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84264
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v2 14/23] block/dirty-bitmaps: prohibit enable/disable on locked/frozen bitmaps
|
|
|
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 |
We're not being consistent about this. If it's in use by an operation,
|
|
|
7711c0 |
the user should not be able to change the behavior of that bitmap.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
Message-id: 20181002230218.13949-5-jsnow@redhat.com
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit b053bb55738f35832f3d6472b12277a75c32a038)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
blockdev.c | 26 ++++++++++++++++++++------
|
|
|
7711c0 |
1 file changed, 20 insertions(+), 6 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
7711c0 |
index 7300f01..9921de6 100644
|
|
|
7711c0 |
--- a/blockdev.c
|
|
|
7711c0 |
+++ b/blockdev.c
|
|
|
7711c0 |
@@ -2210,6 +2210,13 @@ static void block_dirty_bitmap_enable_prepare(BlkActionState *common,
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
+ if (bdrv_dirty_bitmap_user_locked(state->bitmap)) {
|
|
|
7711c0 |
+ error_setg(errp,
|
|
|
7711c0 |
+ "Bitmap '%s' is currently in use by another operation"
|
|
|
7711c0 |
+ " and cannot be enabled", action->name);
|
|
|
7711c0 |
+ return;
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+
|
|
|
7711c0 |
state->was_enabled = bdrv_dirty_bitmap_enabled(state->bitmap);
|
|
|
7711c0 |
bdrv_enable_dirty_bitmap(state->bitmap);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
@@ -2244,6 +2251,13 @@ static void block_dirty_bitmap_disable_prepare(BlkActionState *common,
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
+ if (bdrv_dirty_bitmap_user_locked(state->bitmap)) {
|
|
|
7711c0 |
+ error_setg(errp,
|
|
|
7711c0 |
+ "Bitmap '%s' is currently in use by another operation"
|
|
|
7711c0 |
+ " and cannot be disabled", action->name);
|
|
|
7711c0 |
+ return;
|
|
|
7711c0 |
+ }
|
|
|
7711c0 |
+
|
|
|
7711c0 |
state->was_enabled = bdrv_dirty_bitmap_enabled(state->bitmap);
|
|
|
7711c0 |
bdrv_disable_dirty_bitmap(state->bitmap);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
@@ -3085,10 +3099,10 @@ void qmp_x_block_dirty_bitmap_enable(const char *node, const char *name,
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
- if (bdrv_dirty_bitmap_frozen(bitmap)) {
|
|
|
7711c0 |
+ if (bdrv_dirty_bitmap_user_locked(bitmap)) {
|
|
|
7711c0 |
error_setg(errp,
|
|
|
7711c0 |
- "Bitmap '%s' is currently frozen and cannot be enabled",
|
|
|
7711c0 |
- name);
|
|
|
7711c0 |
+ "Bitmap '%s' is currently in use by another operation"
|
|
|
7711c0 |
+ " and cannot be enabled", name);
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
@@ -3106,10 +3120,10 @@ void qmp_x_block_dirty_bitmap_disable(const char *node, const char *name,
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
- if (bdrv_dirty_bitmap_frozen(bitmap)) {
|
|
|
7711c0 |
+ if (bdrv_dirty_bitmap_user_locked(bitmap)) {
|
|
|
7711c0 |
error_setg(errp,
|
|
|
7711c0 |
- "Bitmap '%s' is currently frozen and cannot be disabled",
|
|
|
7711c0 |
- name);
|
|
|
7711c0 |
+ "Bitmap '%s' is currently in use by another operation"
|
|
|
7711c0 |
+ " and cannot be disabled", name);
|
|
|
7711c0 |
return;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|