From nobody Mon Feb 9 00:42:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568994395; cv=none; d=zoho.com; s=zohoarc; b=CXpXCiFDqWN/sQO5gN/KjzHNBf9Lj1zUs7R6nQ1VlI99/OlL5Y8kV9KddKkWJC3gLqwcBXPBI9SHPwS1GX+1b4CvSLE0ftvtVuPSZYzXL1SAWhH78S6ckZPviTb1YwBe0XVEqPnAXRpByQsjAI46X3sdTt+lh2i00SrlkzPpvw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568994395; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0X2v6/X67GevaLozCATeK7Ki+DV9OD5uzMkovuW6MUo=; b=O49SsusuY9CcLnmAWaKBorf/j5waYcZOMSdxzWV/2+/9iq97UewpM29Neuu0F1DMq2DbVcUXyLKBHhR6FQbPu5QmEiTarpEJSDa6Eh0OKsQxR+YcUrX3vMOHNW3Wx4pPupYgGP9+WE2INQx3F2VTDmdPzg/lXTDvL2qyTpCCMeI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568994395458649.5249833361044; Fri, 20 Sep 2019 08:46:35 -0700 (PDT) Received: from localhost ([::1]:32784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBL7B-0007Oj-MG for importer@patchew.org; Fri, 20 Sep 2019 11:46:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBKpj-0000pL-TE for qemu-devel@nongnu.org; Fri, 20 Sep 2019 11:28:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBKpi-0004Uu-N1 for qemu-devel@nongnu.org; Fri, 20 Sep 2019 11:28:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11115) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBKpg-0004SF-Fa; Fri, 20 Sep 2019 11:28:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8ED03082E10; Fri, 20 Sep 2019 15:28:27 +0000 (UTC) Received: from localhost (unknown [10.40.205.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5244D60606; Fri, 20 Sep 2019 15:28:27 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH 09/22] quorum: Add QuorumChild.to_be_replaced Date: Fri, 20 Sep 2019 17:27:51 +0200 Message-Id: <20190920152804.12875-10-mreitz@redhat.com> In-Reply-To: <20190920152804.12875-1-mreitz@redhat.com> References: <20190920152804.12875-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 20 Sep 2019 15:28:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We will need this to verify that Quorum can let one of its children be replaced without breaking anything else. Signed-off-by: Max Reitz --- block/quorum.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/block/quorum.c b/block/quorum.c index cf2171cc74..207054a64e 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -67,6 +67,13 @@ typedef struct QuorumVotes { =20 typedef struct QuorumChild { BdrvChild *child; + + /* + * If set, check whether this node can be replaced without any + * other parent noticing: Unshare CONSISTENT_READ, and take the + * WRITE permission. + */ + bool to_be_replaced; } QuorumChild; =20 /* the following structure holds the state of one quorum instance */ @@ -1128,6 +1135,16 @@ static void quorum_child_perm(BlockDriverState *bs, = BdrvChild *c, uint64_t perm, uint64_t shared, uint64_t *nperm, uint64_t *nshared) { + BDRVQuorumState *s =3D bs->opaque; + int i; + + for (i =3D 0; i < s->num_children; i++) { + if (s->children[i].child =3D=3D c) { + break; + } + } + assert(!c || i < s->num_children); + *nperm =3D perm & DEFAULT_PERM_PASSTHROUGH; =20 /* @@ -1137,6 +1154,12 @@ static void quorum_child_perm(BlockDriverState *bs, = BdrvChild *c, *nshared =3D (shared & (BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED)) | DEFAULT_PERM_UNCHANGED; + + if (c && s->children[i].to_be_replaced) { + /* Prepare for sudden data changes */ + *nperm |=3D BLK_PERM_WRITE; + *nshared &=3D ~BLK_PERM_CONSISTENT_READ; + } } =20 static const char *const quorum_strong_runtime_opts[] =3D { --=20 2.21.0