From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOMHM-0007m8-6E for qemu-devel@nongnu.org; Mon, 01 Sep 2014 03:44:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOMHG-0003fi-6r for qemu-devel@nongnu.org; Mon, 01 Sep 2014 03:43:56 -0400 Received: from mail-pd0-x22b.google.com ([2607:f8b0:400e:c02::22b]:60460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOMHG-0003fV-0I for qemu-devel@nongnu.org; Mon, 01 Sep 2014 03:43:50 -0400 Received: by mail-pd0-f171.google.com with SMTP id y13so5485983pdi.16 for ; Mon, 01 Sep 2014 00:43:45 -0700 (PDT) From: Liu Yuan Date: Mon, 1 Sep 2014 15:43:11 +0800 Message-Id: <1409557394-11853-6-git-send-email-namei.unix@gmail.com> In-Reply-To: <1409557394-11853-1-git-send-email-namei.unix@gmail.com> References: <1409557394-11853-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH 5/8] quorum: fix quorum_aio_cancel() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Benoit Canet , Stefan Hajnoczi For a fifo read pattern, we only have one running aio (possible other cases that has less number than num_children in the future), so we need to check if .acb is NULL against bdrv_aio_cancel() to avoid segfault. Cc: Eric Blake Cc: Benoit Canet Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan --- block/quorum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/quorum.c b/block/quorum.c index 9e056d6..b9eeda3 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -144,7 +144,9 @@ static void quorum_aio_cancel(BlockDriverAIOCB *blockacb) /* cancel all callbacks */ for (i = 0; i < s->num_children; i++) { - bdrv_aio_cancel(acb->qcrs[i].aiocb); + if (acb->qcrs[i].aiocb) { + bdrv_aio_cancel(acb->qcrs[i].aiocb); + } } quorum_aio_release(acb); -- 1.9.1