1 run vma_writer_close_stream inside coroutine
3 Newer qemu (> 2.2.0-rc2) runs pvebackup_complete_cb from main loop,
5 But vma_writer_close_stream triggers an async write (flush), which uses qemu_coroutine_yield(). This only works if called from a coroutine.
9 ===================================================================
10 --- new.orig/blockdev.c 2014-11-20 12:17:17.000000000 +0100
11 +++ new/blockdev.c 2014-11-20 12:17:23.000000000 +0100
12 @@ -2059,6 +2059,13 @@
16 +static void coroutine_fn backup_close_vma_stream(void *opaque)
18 + PVEBackupDevInfo *di = opaque;
20 + vma_writer_close_stream(backup_state.vmaw, di->dev_id);
23 static void pvebackup_complete_cb(void *opaque, int ret)
25 PVEBackupDevInfo *di = opaque;
29 if (backup_state.vmaw) {
30 - vma_writer_close_stream(backup_state.vmaw, di->dev_id);
31 + Coroutine *co = qemu_coroutine_create(backup_close_vma_stream);
32 + qemu_coroutine_enter(co, di);
35 block_job_cb(bs, ret);
36 Index: new/vma-writer.c
37 ===================================================================
38 --- new.orig/vma-writer.c 2014-11-20 12:17:17.000000000 +0100
39 +++ new/vma-writer.c 2014-11-20 12:17:23.000000000 +0100
44 + while (vmaw->co_writer) {
45 + aio_poll(qemu_get_aio_context(), true);
48 assert(vmaw->co_writer == NULL);