yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-for-jobs-do-not-clear-user_paused-until-after-.patch

ae23c9
From e582296e39bcca12dbfb267b3ffc511f3f64c242 Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Wed, 10 Oct 2018 20:50:58 +0100
ae23c9
Subject: [PATCH 1/3] block: for jobs, do not clear user_paused until after the
ae23c9
 resume
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20181010205100.17689-2-jsnow@redhat.com>
ae23c9
Patchwork-id: 82631
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 1/3] block: for jobs, do not clear user_paused until after the resume
ae23c9
Bugzilla: 1635583
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
ae23c9
From: Jeff Cody <jcody@redhat.com>
ae23c9
ae23c9
The function job_cancel_async() will always cause an assert for blockjob
ae23c9
user resume.  We set job->user_paused to false, and then call
ae23c9
job->driver->user_resume().  In the case of blockjobs, this is the
ae23c9
block_job_user_resume() function.
ae23c9
ae23c9
In that function, we assert that job.user_paused is set to true.
ae23c9
Unfortunately, right before calling this function, it has explicitly
ae23c9
been set to false.
ae23c9
ae23c9
The fix is pretty simple: set job->user_paused to false only after the
ae23c9
job user_resume() function has been called.
ae23c9
ae23c9
Reviewed-by: John Snow <jsnow@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
Signed-off-by: Jeff Cody <jcody@redhat.com>
ae23c9
Message-id: bb183b77d8f2dd6bd67b8da559a90ac1e74b2052.1534868459.git.jcody@redhat.com
ae23c9
Signed-off-by: Jeff Cody <jcody@redhat.com>
ae23c9
(cherry picked from commit e321c0597c7590499bacab239d7f86e257f96bcd)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 job.c | 2 +-
ae23c9
 1 file changed, 1 insertion(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/job.c b/job.c
ae23c9
index 3ab8ce1..dfba4bc 100644
ae23c9
--- a/job.c
ae23c9
+++ b/job.c
ae23c9
@@ -700,10 +700,10 @@ static void job_cancel_async(Job *job, bool force)
ae23c9
 {
ae23c9
     if (job->user_paused) {
ae23c9
         /* Do not call job_enter here, the caller will handle it.  */
ae23c9
-        job->user_paused = false;
ae23c9
         if (job->driver->user_resume) {
ae23c9
             job->driver->user_resume(job);
ae23c9
         }
ae23c9
+        job->user_paused = false;
ae23c9
         assert(job->pause_count > 0);
ae23c9
         job->pause_count--;
ae23c9
     }
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9