qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v3 4/5] block/dirty-bitmaps: prohibit enable/dis


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [Qemu-block] [PATCH v3 4/5] block/dirty-bitmaps: prohibit enable/disable on locked/frozen bitmaps
Date: Wed, 26 Sep 2018 15:01:33 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

26.09.2018 02:49, John Snow wrote:
We're not being consistent about this. If it's in use by an operation,
the user should not be able to change the behavior of that bitmap.

Signed-off-by: John Snow <address@hidden>

Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>

---
  blockdev.c | 26 ++++++++++++++++++++------
  1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index e178aae178..751e153557 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2058,6 +2058,13 @@ static void 
block_dirty_bitmap_enable_prepare(BlkActionState *common,
          return;
      }
+ if (!bdrv_dirty_bitmap_user_modifiable(state->bitmap)) {
+        error_setg(errp,
+                   "Bitmap '%s' is currently in-use by another operation"
+                   " and cannot be enabled", action->name);
+        return;
+    }
+
      state->was_enabled = bdrv_dirty_bitmap_enabled(state->bitmap);
      bdrv_enable_dirty_bitmap(state->bitmap);
  }
@@ -2092,6 +2099,13 @@ static void 
block_dirty_bitmap_disable_prepare(BlkActionState *common,
          return;
      }
+ if (!bdrv_dirty_bitmap_user_modifiable(state->bitmap)) {
+        error_setg(errp,
+                   "Bitmap '%s' is currently in-use by another operation"
+                   " and cannot be disabled", action->name);
+        return;
+    }
+
      state->was_enabled = bdrv_dirty_bitmap_enabled(state->bitmap);
      bdrv_disable_dirty_bitmap(state->bitmap);
  }
@@ -2933,10 +2947,10 @@ void qmp_x_block_dirty_bitmap_enable(const char *node, 
const char *name,
          return;
      }
- if (bdrv_dirty_bitmap_frozen(bitmap)) {
+    if (!bdrv_dirty_bitmap_user_modifiable(bitmap)) {
          error_setg(errp,
-                   "Bitmap '%s' is currently frozen and cannot be enabled",
-                   name);
+                   "Bitmap '%s' is currently in-use by another operation"
+                   " and cannot be enabled", name);
          return;
      }
@@ -2954,10 +2968,10 @@ void qmp_x_block_dirty_bitmap_disable(const char *node, const char *name,
          return;
      }
- if (bdrv_dirty_bitmap_frozen(bitmap)) {
+    if (!bdrv_dirty_bitmap_user_modifiable(bitmap)) {
          error_setg(errp,
-                   "Bitmap '%s' is currently frozen and cannot be disabled",
-                   name);
+                   "Bitmap '%s' is currently in-use by another operation"
+                   " and cannot be disabled", name);
          return;
      }


--
Best regards,
Vladimir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]