From patchwork Thu Aug 20 08:14:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 509219 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B3F6C1402A9 for ; Fri, 21 Aug 2015 11:02:38 +1000 (AEST) Received: from localhost ([::1]:38618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSaj6-0007Jl-Uq for incoming@patchwork.ozlabs.org; Thu, 20 Aug 2015 21:02:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSL04-0007KK-47 for qemu-devel@nongnu.org; Thu, 20 Aug 2015 04:15:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSL00-0003Yf-Mb for qemu-devel@nongnu.org; Thu, 20 Aug 2015 04:15:03 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:47065 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSL00-0003XE-CA for qemu-devel@nongnu.org; Thu, 20 Aug 2015 04:15:00 -0400 Received: (qmail 11888 invoked by uid 89); 20 Aug 2015 08:14:56 -0000 Received: from [82.141.1.145] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.98.7/20811. hbedv: 8.3.32.46/7.12.1.136. spamassassin: 3.4.0. Clear:RC:1(82.141.1.145):SA:0(-1.2/5.0):. Processed in 0.803996 secs); 20 Aug 2015 08:14:56 -0000 Received: from ns.kamp-intra.net (HELO dns.kamp-intra.net) ([82.141.1.145]) by mx01.kamp.de with SMTP; 20 Aug 2015 08:14:55 -0000 X-GL_Whitelist: yes Received: from lieven-pc (lieven-pc.kamp-intra.net [172.21.12.60]) by dns.kamp-intra.net (Postfix) with ESMTP id 80583E0067; Thu, 20 Aug 2015 10:14:15 +0200 (CEST) Received: by lieven-pc (Postfix, from userid 1000) id 60A3120273; Thu, 20 Aug 2015 10:14:15 +0200 (CEST) From: Peter Lieven To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Thu, 20 Aug 2015 10:14:07 +0200 Message-Id: <1440058448-27847-2-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440058448-27847-1-git-send-email-pl@kamp.de> References: <1440058448-27847-1-git-send-email-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a02:248:0:51::16 Cc: kwolf@redhat.com, stefanha@gmail.com, Peter Lieven , jsnow@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 1/2] block/io: allow AIOCB without callback 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If the backend storage is unresponsive and we cancel a request due to a timeout we cannot immediately destroy the AIOCB because the storage might complete the original request laster if it is responsive again. For this purpose allow to set the callback to NULL and ignore it in this case. Signed-off-by: Peter Lieven --- block/io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/io.c b/block/io.c index d4bc83b..e628581 100644 --- a/block/io.c +++ b/block/io.c @@ -2007,7 +2007,9 @@ static void bdrv_aio_bh_cb(void *opaque) qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); } qemu_vfree(acb->bounce); - acb->common.cb(acb->common.opaque, acb->ret); + if (acb->common.cb) { + acb->common.cb(acb->common.opaque, acb->ret); + } qemu_bh_delete(acb->bh); acb->bh = NULL; qemu_aio_unref(acb); @@ -2075,7 +2077,9 @@ static const AIOCBInfo bdrv_em_co_aiocb_info = { static void bdrv_co_complete(BlockAIOCBCoroutine *acb) { if (!acb->need_bh) { - acb->common.cb(acb->common.opaque, acb->req.error); + if (acb->common.cb) { + acb->common.cb(acb->common.opaque, acb->req.error); + } qemu_aio_unref(acb); } }