From patchwork Thu Nov 4 13:15:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 70135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 06AF61007D2 for ; Fri, 5 Nov 2010 00:29:20 +1100 (EST) Received: from localhost ([127.0.0.1]:41786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDzsT-00083M-DC for incoming@patchwork.ozlabs.org; Thu, 04 Nov 2010 09:29:17 -0400 Received: from [140.186.70.92] (port=48278 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDzen-00011j-E8 for qemu-devel@nongnu.org; Thu, 04 Nov 2010 09:15:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDzei-00038v-Rh for qemu-devel@nongnu.org; Thu, 04 Nov 2010 09:15:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDzei-00038r-I4 for qemu-devel@nongnu.org; Thu, 04 Nov 2010 09:15:04 -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 oA4DF1lA000862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Nov 2010 09:15:02 -0400 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oA4DEohm027227; Thu, 4 Nov 2010 09:15:00 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Thu, 4 Nov 2010 14:15:37 +0100 Message-Id: <1288876539-8300-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1288876539-8300-1-git-send-email-kwolf@redhat.com> References: <1288876539-8300-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 08/10] ide: Handle immediate bdrv_aio_flush failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); } }