From: John Snow Date: Mon, 29 Oct 2018 20:23:16 +0000 (-0400) Subject: block/dirty-bitmaps: fix merge permissions X-Git-Tag: v3.1.0-rc0~24^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=283d7a04f2addcc51468635300208b60c19a0db3;p=thirdparty%2Fqemu.git block/dirty-bitmaps: fix merge permissions 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 --- diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 9603cdd29bf..bfccb0ea15e 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -806,9 +806,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; }