From 971a623b5bb048b3ecf079f4a761d423388ea59c Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 3 Apr 2019 18:18:54 +0200 Subject: [PATCH 149/163] block/dirty-bitmaps: disallow busy bitmaps as merge source RH-Author: John Snow Message-id: <20190403181857.9693-19-jsnow@redhat.com> Patchwork-id: 85422 O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 18/21] block/dirty-bitmaps: disallow busy bitmaps as merge source Bugzilla: 1677073 RH-Acked-by: Max Reitz RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Sergio Lopez Pascual We didn't do any state checking on source bitmaps at all, so this adds inconsistent and busy checks. readonly is allowed, so you can still copy a readonly bitmap to a new destination to use it for operations like drive-backup. Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190301191545.8728-7-jsnow@redhat.com Signed-off-by: John Snow (cherry picked from commit cb8e58e3de1a0f39c60de272faa0133b98b02cb5) Signed-off-by: John Snow Signed-off-by: Miroslav Rezanina --- block/dirty-bitmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 6170f3a..2139354 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -825,6 +825,9 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, const BdrvDirtyBitmap *src, goto out; } + if (bdrv_dirty_bitmap_check(src, BDRV_BITMAP_ALLOW_RO, errp)) { + goto out; + } if (!hbitmap_can_merge(dest->bitmap, src->bitmap)) { error_setg(errp, "Bitmaps are incompatible and can't be merged"); -- 1.8.3.1