Il 24/01/2013 08:42, Dietmar Maurer ha scritto: >>> But when I use a thread it triggers the bug in bdrv_drain_all(). So >>> how can I fix bdrv_drain_all() if I use a separate thread to write data? >> >> The bug is, in all likelihood, in your own code. Sorry. :) > > yes. I still not fully understand that aio code. > > If I detect a incomplete write, I register an aio handler like this: > > ret = write(fd, buf, count) > if (ret < 0 && (errno == EAGAIN || errno == EWOULDBLOCK) ) { > ... > qemu_aio_set_fd_handler(fd, NULL, vma_co_continue_write, NULL, > mydata); > qemu_coroutine_yield(); > > But seems that qemu_aio_wait() returns false after that. > > I thought that should return true instead?
You need a flush handler (fourth argument to qemu_aio_set_fd_handler) that returns true. Paolo