From patchwork Tue Mar 15 09:41:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 8586561 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B04999F54C for ; Tue, 15 Mar 2016 09:42:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 230C9201EC for ; Tue, 15 Mar 2016 09:42:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69097201C7 for ; Tue, 15 Mar 2016 09:42:25 +0000 (UTC) Received: from localhost ([::1]:46730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aflUd-0006MK-WF for patchwork-qemu-devel@patchwork.kernel.org; Tue, 15 Mar 2016 05:42:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aflUS-0006KY-4T for qemu-devel@nongnu.org; Tue, 15 Mar 2016 05:42:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aflUO-0002MH-Iy for qemu-devel@nongnu.org; Tue, 15 Mar 2016 05:42:12 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:11171 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aflUO-0002Ip-CY; Tue, 15 Mar 2016 05:42:08 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BJAgCX1+dW/5tjdVteGQEBAhIBAYMVgT+mXAECAQEBBQGBDwGQSIIPAQ2BcIYNAoE1OBQBAQEBAQEBZCeEQgEBBCdSED8SPBsZiCkBvFYBAQEHIIVSgkOHToNuBZdPiGGFIIFlh2+FMUSOOx4BAUKCAxmBS2iKYwEBAQ X-IPAS-Result: A2BJAgCX1+dW/5tjdVteGQEBAhIBAYMVgT+mXAECAQEBBQGBDwGQSIIPAQ2BcIYNAoE1OBQBAQEBAQEBZCeEQgEBBCdSED8SPBsZiCkBvFYBAQEHIIVSgkOHToNuBZdPiGGFIIFlh2+FMUSOOx4BAUKCAxmBS2iKYwEBAQ X-IronPort-AV: E=Sophos;i="5.24,338,1454972400"; d="scan'208";a="98051560" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 15 Mar 2016 10:41:52 +0100 Received: from dsl-hkibrasgw4-50df50-201.dhcp.inet.fi ([80.223.80.201] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1aflU8-0007Ni-FO; Tue, 15 Mar 2016 10:41:52 +0100 Received: from berto by perseus.local with local (Exim 4.86_2) (envelope-from ) id 1aflTv-00064V-3x; Tue, 15 Mar 2016 11:41:39 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Tue, 15 Mar 2016 11:41:35 +0200 Message-Id: X-Mailer: git-send-email 2.7.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Cc: Changlong Xie , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Subject: [Qemu-devel] [PATCH 1/2] quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If there's an I/O error in one of Quorum children then QEMU should emit QUORUM_REPORT_BAD. However this is not working with read-pattern=fifo. This patch fixes this problem. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/quorum.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 3d47351..da15465 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -284,9 +284,17 @@ static void quorum_aio_cb(void *opaque, int ret) QuorumChildRequest *sacb = opaque; QuorumAIOCB *acb = sacb->parent; BDRVQuorumState *s = acb->common.bs->opaque; - QuorumOpType type; bool rewrite = false; + if (ret == 0) { + acb->success_count++; + } else { + QuorumOpType type; + type = acb->is_read ? QUORUM_OP_TYPE_READ : QUORUM_OP_TYPE_WRITE; + quorum_report_bad(type, acb->sector_num, acb->nb_sectors, + sacb->aiocb->bs->node_name, ret); + } + if (acb->is_read && s->read_pattern == QUORUM_READ_PATTERN_FIFO) { /* We try to read next child in FIFO order if we fail to read */ if (ret < 0 && (acb->child_iter + 1) < s->num_children) { @@ -303,15 +311,8 @@ static void quorum_aio_cb(void *opaque, int ret) return; } - type = acb->is_read ? QUORUM_OP_TYPE_READ : QUORUM_OP_TYPE_WRITE; sacb->ret = ret; acb->count++; - if (ret == 0) { - acb->success_count++; - } else { - quorum_report_bad(type, acb->sector_num, acb->nb_sectors, - sacb->aiocb->bs->node_name, ret); - } assert(acb->count <= s->num_children); assert(acb->success_count <= s->num_children); if (acb->count < s->num_children) {