From nobody Thu Nov 6 08:27:42 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.zohomail.com; dkim=fail; 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 1539787020154293.915332393216; Wed, 17 Oct 2018 07:37:00 -0700 (PDT) Received: from localhost ([::1]:37030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCmwR-0001SH-B2 for importer@patchew.org; Wed, 17 Oct 2018 10:36:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCmuJ-0000DA-6B for qemu-devel@nongnu.org; Wed, 17 Oct 2018 10:34:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCmuG-0006HU-QW for qemu-devel@nongnu.org; Wed, 17 Oct 2018 10:34:43 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:48027) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCmuG-0005ot-8W; Wed, 17 Oct 2018 10:34:40 -0400 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1gCmtt-0004Gp-AQ; Wed, 17 Oct 2018 16:34:17 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1gCmtb-0003ib-Au; Wed, 17 Oct 2018 17:33:59 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=eEG8rSmGvJF+bWufq/aBbY6dyeXCQnXdefWMrgNKHyM=; b=lIEuHvgTxH7tiLanZRS7Tjexj+61Jk6lPYngsy07R0IXiSkFKC3RSoxJDhKbzUzX4mCQNkxzukqkQVcjLUcv/2NcpCW8u76IuG9lPr/xvXwvWsgjkQvDG4YOpdJCBRs51zn2/NgCZr8jdKP2kSCPeL6JCrFhE/kn2T1eMB8k34QcjNh6Up71mlJvZHSjWyT2hjSPM5wwYLDUe+Tcp9SMsBrr5w61znlhl8qAQPQW2zv/cck0TC273i0baFuqijkttQZMBP/OBn9oHTE7yJuY7uBOBEkMKAvzApoIzmSxYM3bVW+PSEFh0ebabZ7xPb3aiiQo842dl5xRWXnro/Lsbg==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Wed, 17 Oct 2018 17:33:50 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 2/3] quorum: Return an error if the blkverify mode has invalid settings 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 , Alberto Garcia , Markus Armbruster , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The blkverify mode of Quorum can only be enabled if the number of children is exactly two and the value of vote-threshold is also two. If the user tries to enable it but the other settings are incorrect then QEMU simply prints an error message to stderr and carries on disabling the blkverify setting. This patch makes quorum_open() fail and return an error in this case. Signed-off-by: Alberto Garcia Reported-by: Markus Armbruster --- block/quorum.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index b1b777baef..6188ff6666 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -912,13 +912,12 @@ static int quorum_open(BlockDriverState *bs, QDict *o= ptions, int flags, s->read_pattern =3D ret; =20 if (s->read_pattern =3D=3D QUORUM_READ_PATTERN_QUORUM) { - /* is the driver in blkverify mode */ - if (qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, false) && - s->num_children =3D=3D 2 && s->threshold =3D=3D 2) { - s->is_blkverify =3D true; - } else if (qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, false)) { - fprintf(stderr, "blkverify mode is set by setting blkverify=3D= on " - "and using two files with vote_threshold=3D2\n"); + s->is_blkverify =3D qemu_opt_get_bool(opts, QUORUM_OPT_BLKVERIFY, = false); + if (s->is_blkverify && (s->num_children !=3D 2 || s->threshold != =3D 2)) { + error_setg(&local_err, "blkverify=3Don can only be set if ther= e are " + "exactly two files and vote-threshold is 2"); + ret =3D -EINVAL; + goto exit; } =20 s->rewrite_corrupted =3D qemu_opt_get_bool(opts, QUORUM_OPT_REWRIT= E, --=20 2.11.0