51d9a2
From 91562c1fe9b578b9d96f259b45bdb7866262ff88 Mon Sep 17 00:00:00 2001
51d9a2
Message-Id: <91562c1fe9b578b9d96f259b45bdb7866262ff88@dist-git>
51d9a2
From: Michal Privoznik <mprivozn@redhat.com>
51d9a2
Date: Wed, 4 Jul 2018 14:51:17 +0200
51d9a2
Subject: [PATCH] qemuDomainNestedJobAllowed: Allow QEMU_JOB_NONE
51d9a2
51d9a2
https://bugzilla.redhat.com/show_bug.cgi?id=1598084
51d9a2
51d9a2
When creating a snapshot with --quiesce an async job is grabbed
51d9a2
and just before executing guest fs-freeze command an agent job is
51d9a2
grabbed. This is achieved by calling
51d9a2
51d9a2
  qemuDomainObjBeginJobInternal(job = QEMU_JOB_NONE,
51d9a2
                                agentJob = QEMU_AGENT_JOB_MODIFY);
51d9a2
51d9a2
Since there already is an async job set on the domain (by the
51d9a2
same thread) qemuDomainNestedJobAllowed(priv, job) is consulted
51d9a2
if @job is allowed by job mask. But this function returns false
51d9a2
(meaning sync @job is not allowed) which leads to a deadlock.
51d9a2
51d9a2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
51d9a2
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
51d9a2
(cherry picked from commit 2647a363676833371ba400374ecfa51c84fec5c0)
51d9a2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
51d9a2
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
51d9a2
---
51d9a2
 src/qemu/qemu_domain.c | 4 +++-
51d9a2
 1 file changed, 3 insertions(+), 1 deletion(-)
51d9a2
51d9a2
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
51d9a2
index 3f3bb94685..fa952f8306 100644
51d9a2
--- a/src/qemu/qemu_domain.c
51d9a2
+++ b/src/qemu/qemu_domain.c
51d9a2
@@ -6386,7 +6386,9 @@ qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj)
51d9a2
 static bool
51d9a2
 qemuDomainNestedJobAllowed(qemuDomainObjPrivatePtr priv, qemuDomainJob job)
51d9a2
 {
51d9a2
-    return !priv->job.asyncJob || (priv->job.mask & JOB_MASK(job)) != 0;
51d9a2
+    return !priv->job.asyncJob ||
51d9a2
+           job == QEMU_JOB_NONE ||
51d9a2
+           (priv->job.mask & JOB_MASK(job)) != 0;
51d9a2
 }
51d9a2
 
51d9a2
 bool
51d9a2
-- 
51d9a2
2.18.0
51d9a2