From patchwork Wed Mar 9 16:11:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 8547351 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 D80EC9F46A for ; Wed, 9 Mar 2016 16:14:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D492020211 for ; Wed, 9 Mar 2016 16:14: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 2FA14202AE for ; Wed, 9 Mar 2016 16:14:25 +0000 (UTC) Received: from localhost ([::1]:42367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adgki-0002UF-Iq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 09 Mar 2016 11:14:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adgiE-00076B-JR for qemu-devel@nongnu.org; Wed, 09 Mar 2016 11:11:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adgi8-0006K0-SC for qemu-devel@nongnu.org; Wed, 09 Mar 2016 11:11:50 -0500 Received: from smtp3.mundo-r.com ([212.51.32.191]:5666 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adgi8-0006Jb-LJ; Wed, 09 Mar 2016 11:11:44 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2C0CwA1SuBW/5tjdVteGQEBAg8BAQKDC4E/pmkBAQEBAQEFAYEPAZA8hA6GDwKBSDsRAQEBAQEBAWQnQRIBg24BAQQnUhA/EjwbGYgoAb9rASmFUIJDh02DbgWXN41yiSuFUUSOGjYsg2Zoh1eBfAEBAQ X-IPAS-Result: A2C0CwA1SuBW/5tjdVteGQEBAg8BAQKDC4E/pmkBAQEBAQEFAYEPAZA8hA6GDwKBSDsRAQEBAQEBAWQnQRIBg24BAQQnUhA/EjwbGYgoAb9rASmFUIJDh02DbgWXN41yiSuFUUSOGjYsg2Zoh1eBfAEBAQ X-IronPort-AV: E=Sophos;i="5.24,311,1454972400"; d="scan'208";a="95720077" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 09 Mar 2016 17:11:42 +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 1adgi5-0007l5-Qm; Wed, 09 Mar 2016 17:11:42 +0100 Received: from berto by perseus.local with local (Exim 4.86_2) (envelope-from ) id 1adghp-00070i-6x; Wed, 09 Mar 2016 18:11:25 +0200 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Wed, 9 Mar 2016 18:11:18 +0200 Message-Id: <8ad83e37ec80ac89ee7a30426c4b0f2c02e033eb.1457539274.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 , qemu-block@nongnu.org Subject: [Qemu-devel] [PATCH 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; }