From nobody Thu May 2 21:01:29 2024 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 1502109533614649.7225446344987; Mon, 7 Aug 2017 05:38:53 -0700 (PDT) Received: from localhost ([::1]:37104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dehJ4-0003Fs-SN for importer@patchew.org; Mon, 07 Aug 2017 08:38:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dehHv-0002uC-3P for qemu-devel@nongnu.org; Mon, 07 Aug 2017 08:37:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dehHq-0002Rx-3y for qemu-devel@nongnu.org; Mon, 07 Aug 2017 08:37:39 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:35226) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dehHp-0002Q8-OX; Mon, 07 Aug 2017 08:37:34 -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 1dehHl-0005nb-Bo; Mon, 07 Aug 2017 14:37:29 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1dehHT-0007Us-Ox; Mon, 07 Aug 2017 15:37:11 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Message-Id:Date:Subject:Cc:To:From; bh=+BVH2Zg2pS+FuMofMtD6Ufv31DvGTzYwZKkH5bWmMNw=; b=H7IxqFAgE6hirBZiUEm8xHEPgP2caP8UaT0U1LkaGD24THn2nQvmlUogmqzxywiy8Y6+v3KsQcVQ6PrOHajZK/bBm0BxfZZmkB5XPhZwolP0w/FPQrEMCV78gut1Mx14teAu4i2I9fXX3dMmNNImtDv18eHBIBg6wlwMyPndz/sDwGIDkbfqHH7PQzC/WfUUK2J31px8ugT50CygypwyJ9Ppf3d0UYN4ZeUyOax8syOryCCuTqEYhKEoq5/8bRAAqixCku5/s28JyTEJgh6UOT5ZyAVGmT5c5NLrVMEdyeC4CnwWM93wL7k8uAm7Ejy2sHmkDvUyomLj/jyLK5ZLpQ==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 7 Aug 2017 15:36:58 +0300 Message-Id: <20170807123658.28772-1-berto@igalia.com> X-Mailer: git-send-email 2.11.0 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 for-2.10] quorum: Set sectors-count to 0 when reporting a flush error 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: Alberto Garcia , Markus Armbruster , qemu-block@nongnu.org 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 QUORUM_REPORT_BAD event has fields to report the sector in which the error was detected and the number of affected sectors starting from that one. This is important for read and write errors, but not for flush errors. For flush errors the current code reports the total size of the disk image. That is however not useful information in this case. Moreover, the bdrv_getlength() call can fail, and there's no good way of handling that failure. Since we're reporting useless information and we cannot even guarantee to do it in a consistent way, this patch changes the code to report 0 instead in all cases. Reported-by: Markus Armbruster Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake --- block/quorum.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 55ba916655..d04da4f430 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -785,8 +785,7 @@ static coroutine_fn int quorum_co_flush(BlockDriverStat= e *bs) for (i =3D 0; i < s->num_children; i++) { result =3D bdrv_co_flush(s->children[i]->bs); if (result) { - quorum_report_bad(QUORUM_OP_TYPE_FLUSH, 0, - bdrv_getlength(s->children[i]->bs), + quorum_report_bad(QUORUM_OP_TYPE_FLUSH, 0, 0, s->children[i]->bs->node_name, result); result_value.l =3D result; quorum_count_vote(&error_votes, &result_value, i); --=20 2.11.0