From c215981d4abf69a7aaac79dbeea3e5c1ad2ac115 Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 6 Feb 2019 22:12:32 +0100 Subject: [PATCH 22/33] block/dirty-bitmaps: fix merge permissions RH-Author: John Snow Message-id: <20190206221243.7407-13-jsnow@redhat.com> Patchwork-id: 84275 O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v2 12/23] block/dirty-bitmaps: fix merge permissions Bugzilla: 1658343 RH-Acked-by: Thomas Huth RH-Acked-by: Laurent Vivier RH-Acked-by: Stefan Hajnoczi 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 Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20181002230218.13949-3-jsnow@redhat.com Signed-off-by: John Snow (cherry picked from commit 283d7a04f2addcc51468635300208b60c19a0db3) Signed-off-by: John Snow Signed-off-by: Miroslav Rezanina --- 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 8cc7b71..8c7dc60 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -805,9 +805,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; } -- 1.8.3.1