From patchwork Thu Mar 10 11:55:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 8556661 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 291CF9F46A for ; Thu, 10 Mar 2016 11:59:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D7292035B for ; Thu, 10 Mar 2016 11:59:54 +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 D68F920259 for ; Thu, 10 Mar 2016 11:59:53 +0000 (UTC) Received: from localhost ([::1]:47782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adzFx-0007fh-AW for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Mar 2016 06:59:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adzDa-0003er-RQ for qemu-devel@nongnu.org; Thu, 10 Mar 2016 06:57:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adzDY-0007MV-IJ for qemu-devel@nongnu.org; Thu, 10 Mar 2016 06:57:26 -0500 Received: from smtp3.mundo-r.com ([212.51.32.191]:5718 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adzDY-0007Lj-Bi; Thu, 10 Mar 2016 06:57:24 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BEAwBqYOFW/5tjdVteGQEDEwGDDYE/pnMFAYEPkEKCEwENgW2GDwKBQDgUAQEBAQEBAWQnQRIBg24BAQQnUhA/EjwbGYgoAb0sASmFUIJDh02DbgWXPI14iS2FUkSOJh4BAUKDZmiHV4F8AQEB X-IPAS-Result: A2BEAwBqYOFW/5tjdVteGQEDEwGDDYE/pnMFAYEPkEKCEwENgW2GDwKBQDgUAQEBAQEBAWQnQRIBg24BAQQnUhA/EjwbGYgoAb0sASmFUIJDh02DbgWXPI14iS2FUkSOJh4BAUKDZmiHV4F8AQEB X-IronPort-AV: E=Sophos;i="5.24,315,1454972400"; d="scan'208";a="98056771" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 10 Mar 2016 12:56:01 +0100 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim) id 1adzCD-000890-BO; Thu, 10 Mar 2016 12:56:01 +0100 Received: from berto by perseus.local with local (Exim 4.86_2) (envelope-from ) id 1adzBt-00016a-AC; Thu, 10 Mar 2016 13:55:41 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 10 Mar 2016 13:55:24 +0200 Message-Id: <8138570d071ba7e25db3736979234a1fd71dbd05.1457610443.git.berto@igalia.com> 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: Alberto Garcia , Changlong Xie , qemu-block@nongnu.org, Max Reitz Subject: [Qemu-devel] [PATCH v2 1/4] quorum: Fix crash in quorum_aio_cb() 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 quorum_aio_cb() emits the QUORUM_REPORT_BAD event if there's an I/O error in a Quorum child. However sacb->aiocb must be correctly initialized for this to happen. read_quorum_children() and read_fifo_child() are not doing this, which results in a QEMU crash. Signed-off-by: Alberto Garcia Reviewed-by: Max Reitz --- block/quorum.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/quorum.c b/block/quorum.c index 11cc60b..73ff309 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -648,8 +648,9 @@ static BlockAIOCB *read_quorum_children(QuorumAIOCB *acb) } for (i = 0; i < s->num_children; i++) { - bdrv_aio_readv(s->children[i]->bs, acb->sector_num, &acb->qcrs[i].qiov, - acb->nb_sectors, quorum_aio_cb, &acb->qcrs[i]); + acb->qcrs[i].aiocb = bdrv_aio_readv(s->children[i]->bs, acb->sector_num, + &acb->qcrs[i].qiov, acb->nb_sectors, + quorum_aio_cb, &acb->qcrs[i]); } return &acb->common; @@ -664,9 +665,10 @@ static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb) qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, acb->qiov, acb->qcrs[acb->child_iter].buf); - bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, - &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, - quorum_aio_cb, &acb->qcrs[acb->child_iter]); + acb->qcrs[acb->child_iter].aiocb = + bdrv_aio_readv(s->children[acb->child_iter]->bs, acb->sector_num, + &acb->qcrs[acb->child_iter].qiov, acb->nb_sectors, + quorum_aio_cb, &acb->qcrs[acb->child_iter]); return &acb->common; }