From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 30 Oct 2019 12:15:45 +0100 Subject: [PATCH] fix backup job completion With recent changes, pvebackup_co_run_next_job cancels the job async, so we need to run pvebackup_co_cleanup in the completion handler instead. We call pvebackup_co_run_next as long as there are jobs in the list. --- blockdev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/blockdev.c b/blockdev.c index 568f71fdb4..66f2711185 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3359,12 +3359,14 @@ static void coroutine_fn pvebackup_co_complete_cb(void *opaque) backup_state.di_list = g_list_remove(backup_state.di_list, di); g_free(di); - bool cancel = backup_state.cancel; + int pending_jobs = g_list_length(backup_state.di_list); qemu_co_mutex_unlock(&backup_state.backup_mutex); - if (!cancel) { + if (pending_jobs > 0) { pvebackup_co_run_next_job(); + } else { + pvebackup_co_cleanup(); } } @@ -3510,9 +3512,6 @@ static void coroutine_fn pvebackup_co_run_next_job(void) } } qemu_co_mutex_unlock(&backup_state.backup_mutex); - - // no more jobs, run the cleanup - pvebackup_co_cleanup(); } typedef struct QmpBackupTask {