[pve-devel] [PATCH qemu 1/2] PVE: Don't expect complete_cb to be called outside coroutine
Wolfgang Bumiller
w.bumiller at proxmox.com
Tue Oct 27 15:16:22 CET 2020
On Thu, Oct 22, 2020 at 02:11:17PM +0200, Stefan Reiter wrote:
> We're at the mercy of the rest of QEMU here, and it sometimes decides to
> call pvebackup_complete_cb from a coroutine. This really doesn't matter
> to us, so don't assert and crash on it.
>
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
> pve-backup.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/pve-backup.c b/pve-backup.c
> index 53cf23ed5a..9179754dcb 100644
> --- a/pve-backup.c
> +++ b/pve-backup.c
> @@ -318,19 +318,18 @@ static void coroutine_fn pvebackup_co_complete_stream(void *opaque)
>
> static void pvebackup_complete_cb(void *opaque, int ret)
> {
> - assert(!qemu_in_coroutine());
> -
> PVEBackupDevInfo *di = opaque;
> di->completed_ret = ret;
>
> /*
> * Schedule stream cleanup in async coroutine. close_image and finish might
> - * take a while, so we can't block on them here.
> + * take a while, so we can't block on them here. This way it also doesn't
> + * matter if we're already running in a coroutine or not.
> * Note: di is a pointer to an entry in the global backup_state struct, so
> * it stays valid.
> */
> Coroutine *co = qemu_coroutine_create(pvebackup_co_complete_stream, di);
> - aio_co_schedule(qemu_get_aio_context(), co);
> + aio_co_enter(qemu_get_aio_context(), co);
Shouldn't this be decided based on `qemu_in_coroutine()`? Or are we
allowed to call enter regardless, I forgot...?
> }
>
> static void coroutine_fn pvebackup_co_cancel(void *opaque)
> --
> 2.20.1
More information about the pve-devel
mailing list