summaryrefslogtreecommitdiff
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
commit774f033d8ad958200abbbd67e2adbb449424fa7b (patch)
tree5e5f77b884c4e118bc8f31e047207f853b70fe8c
parent44873881125cfd96d1d1aec60cbeedb181168e86 (diff)
downloadqemu-774f033d8ad958200abbbd67e2adbb449424fa7b.tar.gz
qemu-774f033d8ad958200abbbd67e2adbb449424fa7b.tar.bz2
qemu-774f033d8ad958200abbbd67e2adbb449424fa7b.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>
-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);
}
}