yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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