X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=aio.c;h=efc63fd9a1f60d45e54bfa462a63edbdbbeade95;hb=435c247a9fffe77940229220696abe82714da13e;hp=200320c979425bb25b8a3f0cc4aa6c33299f0ad3;hpb=1eec614b36390be66430ed6dd0ce47a6f2f0ae1a;p=qemu diff --git a/aio.c b/aio.c index 200320c..efc63fd 100644 --- a/aio.c +++ b/aio.c @@ -44,7 +44,8 @@ static AioHandler *find_aio_handler(int fd) LIST_FOREACH(node, &aio_handlers, node) { if (node->fd == fd) - return node; + if (!node->deleted) + return node; } return NULL; @@ -102,12 +103,16 @@ void qemu_aio_flush(void) do { ret = 0; + /* + * If there are pending emulated aio start them now so flush + * will be able to return 1. + */ + qemu_aio_wait(); + LIST_FOREACH(node, &aio_handlers, node) { ret |= node->io_flush(node->opaque); } - - qemu_aio_wait(); - } while (ret > 0); + } while (qemu_bh_poll() || ret > 0); } void qemu_aio_wait(void)