[pve-devel] [PATCH qemu] fix backup job completion

Dietmar Maurer dietmar at proxmox.com
Sat Oct 26 16:39:16 CEST 2019


Please wait, seem this is still buggy - need to do more tests ...

> On 25 October 2019 11:22 Dietmar Maurer <dietmar at proxmox.com> wrote:
> 
>  
> 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.
> 
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
>  blockdev.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index caff370f2e..89b88837cf 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -3491,12 +3491,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();
>      }
>  }
>  
> @@ -3650,9 +3652,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 {
> -- 
> 2.20.1




More information about the pve-devel mailing list