From nobody Thu Nov 6 17:13:37 2025 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488356150785465.18846620158934; Wed, 1 Mar 2017 00:15:50 -0800 (PST) Received: from localhost ([::1]:38998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cizQL-0001qe-62 for importer@patchew.org; Wed, 01 Mar 2017 03:15:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cizPm-0001pD-Tz for qemu-devel@nongnu.org; Wed, 01 Mar 2017 03:15:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cizPm-0003mv-07 for qemu-devel@nongnu.org; Wed, 01 Mar 2017 03:15:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35436) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cizPh-0003kA-3D; Wed, 01 Mar 2017 03:15:09 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE9F63B702; Wed, 1 Mar 2017 08:15:08 +0000 (UTC) Received: from lemon.redhat.com (ovpn-8-19.pek2.redhat.com [10.72.8.19]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v218F5XQ005979; Wed, 1 Mar 2017 03:15:06 -0500 From: Fam Zheng To: qemu-devel@nongnu.org Date: Wed, 1 Mar 2017 16:15:04 +0800 Message-Id: <20170301081504.23595-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 01 Mar 2017 08:15:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC] block: Tolerate existing writers on read only BdrvChild 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 , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In an ideal world, read-write access to an image is inherently exclusive, because we cannot guarantee other readers and writers a consistency view of the whole image at all point. That's what the current permission system does, and it is okay as long as it is entirely internal. But that would change with the coming image locking. In practice, both end users and our test cases use tools like qemu-img and qemu-io to peek at images while guest is running. Relax a bit and accept other writers in this case. Signed-off-by: Fam Zheng --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index f293ccb..9bdd77c 100644 --- a/block.c +++ b/block.c @@ -1685,12 +1685,12 @@ void bdrv_format_default_perms(BlockDriverState *bs= , BdrvChild *c, /* Format drivers may touch metadata even if the guest doesn't wri= te */ if (!bdrv_is_read_only(bs)) { perm |=3D BLK_PERM_WRITE | BLK_PERM_RESIZE; + shared &=3D ~(BLK_PERM_WRITE | BLK_PERM_RESIZE); } =20 /* bs->file always needs to be consistent because of the metadata.= We * can never allow other users to resize or write to it. */ perm |=3D BLK_PERM_CONSISTENT_READ; - shared &=3D ~(BLK_PERM_WRITE | BLK_PERM_RESIZE); } else { /* We want consistent read from backing files if the parent needs = it. * No other operations are performed on backing files. */ --=20 2.9.3