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