5
0
mirror of git://git.proxmox.com/git/pve-qemu.git synced 2024-12-22 17:35:52 +03:00

fixup backup with io-threads

This commit is contained in:
Dietmar Maurer 2020-03-12 10:30:18 +01:00
parent c3e8606cd9
commit 20505f521e
3 changed files with 43 additions and 40 deletions

View File

@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Stefan Reiter <s.reiter@proxmox.com>
Date: Tue, 10 Mar 2020 12:55:23 +0100
Subject: [PATCH 26/32] PVE: Acquire aio_context before calling
block_job_add_bdrv
Otherwise backups immediately fail with 'permission denied' since
_add_bdrv tries to release a lock we don't own.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
blockjob.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/blockjob.c b/blockjob.c
index c6e20e2fcd..4e6074f18c 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -436,10 +436,20 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
notifier_list_add(&job->job.on_ready, &job->ready_notifier);
notifier_list_add(&job->job.on_idle, &job->idle_notifier);
+ /* block_job_add_bdrv expects us to hold the aio context lock, so acquire it
+ * before calling if we're not in the main context anyway. */
+ if (job->job.aio_context != qemu_get_aio_context()) {
+ aio_context_acquire(job->job.aio_context);
+ }
+
error_setg(&job->blocker, "block device is in use by block job: %s",
job_type_str(&job->job));
block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort);
+ if (job->job.aio_context != qemu_get_aio_context()) {
+ aio_context_release(job->job.aio_context);
+ }
+
bdrv_op_unblock(bs, BLOCK_OP_TYPE_DATAPLANE, job->blocker);
/* Disable request queuing in the BlockBackend to avoid deadlocks on drain:

View File

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Wed, 11 Mar 2020 13:00:56 +0100
Subject: [PATCH] PVE-Backup: aquire aio_context before calling
backup_job_create
And do not set target in same aoi_context as source, because
this is already done in bdrv_backup_top_append ...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
pve-backup.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
index 9ae89fb679..38dd33e28b 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -757,17 +757,15 @@ static void coroutine_fn pvebackup_co_start(void *opaque)
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
- // make sure target runs in same aoi_context as source
AioContext *aio_context = bdrv_get_aio_context(di->bs);
aio_context_acquire(aio_context);
- GSList *ignore = NULL;
- bdrv_set_aio_context_ignore(di->target, aio_context, &ignore);
- g_slist_free(ignore);
- aio_context_release(aio_context);
job = backup_job_create(NULL, di->bs, di->target, backup_state.speed, MIRROR_SYNC_MODE_FULL, NULL,
BITMAP_SYNC_MODE_NEVER, false, NULL, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
JOB_DEFAULT, pvebackup_complete_cb, di, 1, NULL, &local_err);
+
+ aio_context_release(aio_context);
+
if (!job || local_err != NULL) {
qemu_co_rwlock_wrlock(&backup_state.stat.rwlock);
error_setg(&backup_state.stat.error, "backup_job_create failed");
--
2.20.1

View File

@ -23,10 +23,10 @@ pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
pve/0023-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch
pve/0024-PVE-move-snapshot-cleanup-into-bottom-half.patch
pve/0025-PVE-monitor-disable-oob-capability.patch
pve/0026-PVE-Acquire-aio_context-before-calling-block_job_add.patch
pve/0027-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
pve/0028-PVE-Allow-version-code-in-machine-type.patch
pve/0029-PVE-Backup-add-vma-backup-format-code.patch
pve/0030-PVE-Backup-add-backup-dump-block-driver.patch
pve/0031-PVE-Backup-proxmox-backup-patches-for-qemu.patch
pve/0032-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
pve/0033-PVE-Backup-aquire-aio_context-before-calling-backup_.patch