diff mbox series

[v4,2/6] block/dirty-bitmaps: fix merge permissions

Message ID 20181002230218.13949-3-jsnow@redhat.com
State New
Headers show
Series dirty-bitmaps: fix QMP command permissions | expand

Commit Message

John Snow Oct. 2, 2018, 11:02 p.m. UTC
In prior commits that made merge transactionable, we removed the
assertion that merge cannot operate on disabled bitmaps. In addition,
we want to make sure that we are prohibiting merges to "locked" bitmaps.

Use the new user_locked function to check.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/dirty-bitmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Blake Oct. 3, 2018, 12:20 p.m. UTC | #1
On 10/2/18 6:02 PM, John Snow wrote:
> In prior commits that made merge transactionable, we removed the
> assertion that merge cannot operate on disabled bitmaps. In addition,
> we want to make sure that we are prohibiting merges to "locked" bitmaps.
> 
> Use the new user_locked function to check.
> 
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>   block/dirty-bitmap.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
Vladimir Sementsov-Ogievskiy Oct. 3, 2018, 1:01 p.m. UTC | #2
03.10.2018 02:02, John Snow wrote:
> In prior commits that made merge transactionable, we removed the
> assertion that merge cannot operate on disabled bitmaps. In addition,
> we want to make sure that we are prohibiting merges to "locked" bitmaps.
>
> Use the new user_locked function to check.
>
> Reported-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: John Snow <jsnow@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

> ---
>   block/dirty-bitmap.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
> index 85bc668f6a..8a6e07930f 100644
> --- a/block/dirty-bitmap.c
> +++ b/block/dirty-bitmap.c
> @@ -806,9 +806,9 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src,
>   
>       qemu_mutex_lock(dest->mutex);
>   
> -    if (bdrv_dirty_bitmap_frozen(dest)) {
> -        error_setg(errp, "Bitmap '%s' is frozen and cannot be modified",
> -                   dest->name);
> +    if (bdrv_dirty_bitmap_user_locked(dest)) {
> +        error_setg(errp, "Bitmap '%s' is currently in use by another"
> +        " operation and cannot be modified", dest->name);
>           goto out;
>       }
>
diff mbox series

Patch

diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 85bc668f6a..8a6e07930f 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -806,9 +806,9 @@  void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src,
 
     qemu_mutex_lock(dest->mutex);
 
-    if (bdrv_dirty_bitmap_frozen(dest)) {
-        error_setg(errp, "Bitmap '%s' is frozen and cannot be modified",
-                   dest->name);
+    if (bdrv_dirty_bitmap_user_locked(dest)) {
+        error_setg(errp, "Bitmap '%s' is currently in use by another"
+        " operation and cannot be modified", dest->name);
         goto out;
     }