From nobody Sun Feb 8 21:47:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537919514400979.5643760899126; Tue, 25 Sep 2018 16:51:54 -0700 (PDT) Received: from localhost ([::1]:55725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4x7H-0000Vt-C1 for importer@patchew.org; Tue, 25 Sep 2018 19:51:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4x5F-0007ju-S0 for qemu-devel@nongnu.org; Tue, 25 Sep 2018 19:49:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4x5F-0007lH-6Q for qemu-devel@nongnu.org; Tue, 25 Sep 2018 19:49:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4x5A-0007gH-NW; Tue, 25 Sep 2018 19:49:32 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BAA030820C2; Tue, 25 Sep 2018 23:49:32 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-171.bos.redhat.com [10.18.17.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1496BD67C9; Tue, 25 Sep 2018 23:49:31 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 25 Sep 2018 19:49:21 -0400 Message-Id: <20180925234924.14338-3-jsnow@redhat.com> In-Reply-To: <20180925234924.14338-1-jsnow@redhat.com> References: <20180925234924.14338-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 25 Sep 2018 23:49:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/5] block/dirty-bitmaps: fix merge permissions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , vsementsov@virtuozzo.com, Fam Zheng , Markus Armbruster , Max Reitz , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We wish to prohibit merging to read-only bitmaps and frozen bitmaps, but "disabled" bitmaps only preclude their recording of live, new information. It does not prohibit them from manual writes at the behest of the user, as is the case for merge operations. Allow the merge to "disabled" bitmaps, and prohibit merging to "locked" ones. Reported-by: Eric Blake Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 fc10543ab0..53b7d282c4 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -806,9 +806,9 @@ void bdrv_merge_dirty_bitmap(BdrvDirtyBitmap *dest, con= st BdrvDirtyBitmap *src, =20 qemu_mutex_lock(dest->mutex); =20 - if (bdrv_dirty_bitmap_frozen(dest)) { - error_setg(errp, "Bitmap '%s' is frozen and cannot be modified", - dest->name); + if (!bdrv_dirty_bitmap_user_modifiable(dest)) { + error_setg(errp, "Bitmap '%s' is currently in-use by another" + " operation and cannot be modified", dest->name); goto out; } =20 --=20 2.14.4