]>
Commit | Line | Data |
---|---|---|
fa46f513 DM |
1 | run vma_writer_close_stream inside coroutine |
2 | ||
3 | Newer qemu (> 2.2.0-rc2) runs pvebackup_complete_cb from main loop, | |
4 | ||
5 | But vma_writer_close_stream triggers an async write (flush), which uses qemu_coroutine_yield(). This only works if called from a coroutine. | |
6 | ||
7 | ||
8 | Index: new/blockdev.c | |
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 @@ | |
13 | } | |
14 | } | |
15 | ||
16 | +static void coroutine_fn backup_close_vma_stream(void *opaque) | |
17 | +{ | |
18 | + PVEBackupDevInfo *di = opaque; | |
19 | + | |
20 | + vma_writer_close_stream(backup_state.vmaw, di->dev_id); | |
21 | +} | |
22 | + | |
23 | static void pvebackup_complete_cb(void *opaque, int ret) | |
24 | { | |
25 | PVEBackupDevInfo *di = opaque; | |
26 | @@ -2076,7 +2083,8 @@ | |
27 | di->target = NULL; | |
28 | ||
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); | |
33 | } | |
34 | ||
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 | |
40 | @@ -706,6 +706,10 @@ | |
41 | ||
42 | int i; | |
43 | ||
44 | + while (vmaw->co_writer) { | |
45 | + aio_poll(qemu_get_aio_context(), true); | |
46 | + } | |
47 | + | |
48 | assert(vmaw->co_writer == NULL); | |
49 | ||
50 | if (vmaw->cmd) { |