From nobody Mon Feb 9 09:34:19 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505327819246115.25406208220522; Wed, 13 Sep 2017 11:36:59 -0700 (PDT) Received: from localhost ([::1]:44088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsCWw-0006Iq-Dy for importer@patchew.org; Wed, 13 Sep 2017 14:36:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsCI1-0000pK-N4 for qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:21:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsCI0-00069F-R8 for qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:21:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dsCHv-00063o-4q; Wed, 13 Sep 2017 14:21:27 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 412C2C04B954; Wed, 13 Sep 2017 18:21:26 +0000 (UTC) Received: from localhost (ovpn-204-23.brq.redhat.com [10.40.204.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E0946179D; Wed, 13 Sep 2017 18:21:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 412C2C04B954 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mreitz@redhat.com From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 13 Sep 2017 20:19:05 +0200 Message-Id: <20170913181910.29688-14-mreitz@redhat.com> In-Reply-To: <20170913181910.29688-1-mreitz@redhat.com> References: <20170913181910.29688-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Sep 2017 18:21:26 +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 13/18] block/mirror: Keep write perm for pending writes 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 , Fam Zheng , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , John Snow 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" The owner of the mirror BDS might retire its write permission; but there may still be pending mirror operations so the mirror BDS cannot necessarily retire its write permission for its child then. Signed-off-by: Max Reitz --- block/mirror.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 05410c94ca..612fab660e 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1236,6 +1236,7 @@ static void bdrv_mirror_top_child_perm(BlockDriverSta= te *bs, BdrvChild *c, uint64_t *nperm, uint64_t *nshared) { MirrorBDSOpaque *s =3D bs->opaque; + bool ops_in_flight =3D s->job && !QTAILQ_EMPTY(&s->job->ops_in_flight); =20 if (s->job && s->job->exiting) { *nperm =3D 0; @@ -1243,9 +1244,10 @@ static void bdrv_mirror_top_child_perm(BlockDriverSt= ate *bs, BdrvChild *c, return; } =20 - /* Must be able to forward guest writes to the real image */ + /* Must be able to forward both new and pending guest writes to + * the real image */ *nperm =3D 0; - if (perm & BLK_PERM_WRITE) { + if ((perm & BLK_PERM_WRITE) || ops_in_flight) { *nperm |=3D BLK_PERM_WRITE; } =20 --=20 2.13.5