From: Kevin Wolf Date: Wed, 27 Oct 2010 11:04:15 +0000 (+0200) Subject: ide: Handle immediate bdrv_aio_flush failure X-Git-Tag: v0.14.0-rc0~484 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b2df7531f3adc4f0f65067b917cef8c66ba812c5;p=thirdparty%2Fqemu.git ide: Handle immediate bdrv_aio_flush failure If bdrv_aio_flush returns NULL, this should be treated as an error. Signed-off-by: Kevin Wolf --- diff --git a/hw/ide/core.c b/hw/ide/core.c index bc3e91658ab..484e0ca96fe 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); } }