Blame SOURCES/kvm-block-dirty-bitmap-add-lock-to-bdrv_enable-disable_d.patch

383d26
From d47b51e706c36542cf32e754fe9c539aed237aef Mon Sep 17 00:00:00 2001
383d26
From: John Snow <jsnow@redhat.com>
383d26
Date: Wed, 18 Jul 2018 22:54:37 +0200
383d26
Subject: [PATCH 52/89] block/dirty-bitmap: add lock to
383d26
 bdrv_enable/disable_dirty_bitmap
383d26
383d26
RH-Author: John Snow <jsnow@redhat.com>
383d26
Message-id: <20180718225511.14878-2-jsnow@redhat.com>
383d26
Patchwork-id: 81426
383d26
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 01/35] block/dirty-bitmap: add lock to bdrv_enable/disable_dirty_bitmap
383d26
Bugzilla: 1207657
383d26
RH-Acked-by: Eric Blake <eblake@redhat.com>
383d26
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
383d26
RH-Acked-by: Fam Zheng <famz@redhat.com>
383d26
383d26
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
383d26
383d26
Add locks and remove comments about BQL accordingly to
383d26
dirty_bitmap_mutex definition in block_int.h.
383d26
383d26
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Reviewed-by: Jeff Cody <jcody@redhat.com>
383d26
Message-id: 20180606182449.1607-2-jsnow@redhat.com
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
(cherry picked from commit 8b1402ce80d74dc02802f101a0f6c340462380d1)
383d26
Signed-off-by: John Snow <jsnow@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 block/dirty-bitmap.c | 6 ++++--
383d26
 1 file changed, 4 insertions(+), 2 deletions(-)
383d26
383d26
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
383d26
index 9671594..5623425 100644
383d26
--- a/block/dirty-bitmap.c
383d26
+++ b/block/dirty-bitmap.c
383d26
@@ -442,18 +442,20 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
383d26
     }
383d26
 }
383d26
 
383d26
-/* Called with BQL taken.  */
383d26
 void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
383d26
 {
383d26
+    bdrv_dirty_bitmap_lock(bitmap);
383d26
     assert(!bdrv_dirty_bitmap_frozen(bitmap));
383d26
     bitmap->disabled = true;
383d26
+    bdrv_dirty_bitmap_unlock(bitmap);
383d26
 }
383d26
 
383d26
-/* Called with BQL taken.  */
383d26
 void bdrv_enable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
383d26
 {
383d26
+    bdrv_dirty_bitmap_lock(bitmap);
383d26
     assert(!bdrv_dirty_bitmap_frozen(bitmap));
383d26
     bitmap->disabled = false;
383d26
+    bdrv_dirty_bitmap_unlock(bitmap);
383d26
 }
383d26
 
383d26
 BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
383d26
-- 
383d26
1.8.3.1
383d26