a9b8206ded
* Fix VMA tool build * Change PVE code to new blockjob API * Acquire missing lock for block_job_add_bdrv Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
82 lines
3.4 KiB
Diff
82 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
Date: Mon, 26 Aug 2019 18:40:44 +0200
|
|
Subject: [PATCH] PVE: fixup: blockdev pvebackup integration: fix blockjob
|
|
|
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
|
---
|
|
blockdev.c | 49 +++++++++++++++++++++++++++----------------------
|
|
1 file changed, 27 insertions(+), 22 deletions(-)
|
|
|
|
diff --git a/blockdev.c b/blockdev.c
|
|
index 083ada6c8e..46e8a2780a 100644
|
|
--- a/blockdev.c
|
|
+++ b/blockdev.c
|
|
@@ -3416,15 +3416,17 @@ static void coroutine_fn pvebackup_co_cancel(void *opaque)
|
|
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
|
|
l = g_list_next(l);
|
|
if (!di->completed && di->bs) {
|
|
- BlockJob *job = di->bs->job;
|
|
- if (job) {
|
|
- AioContext *aio_context = blk_get_aio_context(job->blk);
|
|
- aio_context_acquire(aio_context);
|
|
- if (!di->completed) {
|
|
- running_jobs += 1;
|
|
- job_cancel(&job->job, false);
|
|
+ for (BlockJob *job = block_job_next(NULL); job; job = block_job_next(job)) {
|
|
+ if (block_job_has_bdrv(job, di->bs)) {
|
|
+ AioContext *aio_context = job->job.aio_context;
|
|
+ aio_context_acquire(aio_context);
|
|
+
|
|
+ if (!di->completed) {
|
|
+ running_jobs += 1;
|
|
+ job_cancel(&job->job, false);
|
|
+ }
|
|
+ aio_context_release(aio_context);
|
|
}
|
|
- aio_context_release(aio_context);
|
|
}
|
|
}
|
|
}
|
|
@@ -3499,22 +3501,25 @@ static void coroutine_fn pvebackup_co_run_next_job(void)
|
|
while (l) {
|
|
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
|
|
l = g_list_next(l);
|
|
- if (!di->completed && di->bs && di->bs->job) {
|
|
- BlockJob *job = di->bs->job;
|
|
- AioContext *aio_context = blk_get_aio_context(job->blk);
|
|
- bool cancel_job = backup_state.error || backup_state.cancel;
|
|
- qemu_co_mutex_unlock(&backup_state.backup_mutex);
|
|
-
|
|
- aio_context_acquire(aio_context);
|
|
- if (job_should_pause(&job->job)) {
|
|
- if (cancel_job) {
|
|
- job_cancel(&job->job, false);
|
|
- } else {
|
|
- job_resume(&job->job);
|
|
+ if (!di->completed && di->bs) {
|
|
+ for (BlockJob *job = block_job_next(NULL); job; job = block_job_next(job)) {
|
|
+ if (block_job_has_bdrv(job, di->bs)) {
|
|
+ AioContext *aio_context = job->job.aio_context;
|
|
+ qemu_co_mutex_unlock(&backup_state.backup_mutex);
|
|
+ aio_context_acquire(aio_context);
|
|
+
|
|
+
|
|
+ if (job_should_pause(&job->job)) {
|
|
+ if (backup_state.error || backup_state.cancel) {
|
|
+ job_cancel(&job->job, false);
|
|
+ } else {
|
|
+ job_resume(&job->job);
|
|
+ }
|
|
+ }
|
|
+ aio_context_release(aio_context);
|
|
+ return;
|
|
}
|
|
}
|
|
- aio_context_release(aio_context);
|
|
- return;
|
|
}
|
|
}
|
|
qemu_co_mutex_unlock(&backup_state.backup_mutex);
|