From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33879 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PB44b-0006Ya-3z for qemu-devel@nongnu.org; Wed, 27 Oct 2010 07:22:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PB43B-0004QM-1U for qemu-devel@nongnu.org; Wed, 27 Oct 2010 07:21:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PB43A-0004QE-Q1 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 07:20:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9RBKBWq019670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Oct 2010 07:20:12 -0400 From: Kevin Wolf Date: Wed, 27 Oct 2010 13:20:52 +0200 Message-Id: <1288178454-8893-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1288178454-8893-1-git-send-email-kwolf@redhat.com> References: <1288178454-8893-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 1/3] ide: Handle immediate bdrv_aio_flush failure List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com If bdrv_aio_flush returns NULL, this should be treated as an error. Signed-off-by: Kevin Wolf --- hw/ide/core.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index bc3e916..484e0ca 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -811,10 +811,16 @@ static void ide_flush_cb(void *opaque, int ret) static void ide_flush_cache(IDEState *s) { - if (s->bs) { - bdrv_aio_flush(s->bs, ide_flush_cb, s); - } else { + BlockDriverAIOCB *acb; + + if (s->bs == NULL) { ide_flush_cb(s, 0); + return; + } + + acb = bdrv_aio_flush(s->bs, ide_flush_cb, s); + if (acb == NULL) { + ide_flush_cb(s, -EIO); } } -- 1.7.2.3