6402d96100
The long overdue nice rebase+cleanup was done by Dietmar Originally-by: Dietmar Maurer <dietmar@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
40 lines
1.5 KiB
Diff
40 lines
1.5 KiB
Diff
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:
|