From: John Snow Date: Tue, 12 Mar 2019 16:05:49 +0000 (-0400) Subject: block/dirty-bitmaps: disallow busy bitmaps as merge source X-Git-Tag: v4.0.0-rc0~24^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb8e58e3de1a0f39c60de272faa0133b98b02cb5;p=thirdparty%2Fqemu.git block/dirty-bitmaps: disallow busy bitmaps as merge source 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 --- diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 6170f3a454f..21393542309 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");