summary refs log tree commit diff stats
path: root/hw/ide/core.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-10-27 13:04:15 +0200
committerKevin Wolf <kwolf@redhat.com>2010-11-04 13:54:37 +0100
commitb2df7531f3adc4f0f65067b917cef8c66ba812c5 (patch)
tree5e5f77b884c4e118bc8f31e047207f853b70fe8c /hw/ide/core.c
parenta31335863648d1e707f59296cffb74205aedba96 (diff)
downloadfocaccia-qemu-b2df7531f3adc4f0f65067b917cef8c66ba812c5.tar.gz
focaccia-qemu-b2df7531f3adc4f0f65067b917cef8c66ba812c5.zip
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 <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/core.c')
-rw-r--r--hw/ide/core.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index bc3e91658a..484e0ca96f 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);
     }
 }