]> git.proxmox.com Git - qemu.git/commitdiff
ide: Handle immediate bdrv_aio_flush failure
authorKevin Wolf <kwolf@redhat.com>
Wed, 27 Oct 2010 11:04:15 +0000 (13:04 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 4 Nov 2010 12:54:37 +0000 (13:54 +0100)
If bdrv_aio_flush returns NULL, this should be treated as an error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/ide/core.c

index bc3e91658ab46cbfcbf4761aec24cb2f7c8c68ce..484e0ca96fe4e26635930e9566e44d5f73879769 100644 (file)
@@ -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);
     }
 }