Blame SOURCES/kvm-blockjob-Remove-the-job-from-the-list-earlier-in-blo.patch

4a2fec
From f64ca42ce16a0df89d4abba838d00ea7bc7e4da9 Mon Sep 17 00:00:00 2001
4a2fec
From: Jeffrey Cody <jcody@redhat.com>
4a2fec
Date: Thu, 30 Nov 2017 22:49:11 +0100
4a2fec
Subject: [PATCH 07/21] blockjob: Remove the job from the list earlier in
4a2fec
 block_job_unref()
4a2fec
4a2fec
RH-Author: Jeffrey Cody <jcody@redhat.com>
4a2fec
Message-id: <8fc0c61d51c41fdde7d809502e5025371f89c4c7.1511985875.git.jcody@redhat.com>
4a2fec
Patchwork-id: 78045
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 07/11] blockjob: Remove the job from the list earlier in block_job_unref()
4a2fec
Bugzilla: 1506531
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
4a2fec
From: Alberto Garcia <berto@igalia.com>
4a2fec
4a2fec
When destroying a block job in block_job_unref() we should remove it
4a2fec
from the job list before calling block_job_remove_all_bdrv().
4a2fec
4a2fec
This is because removing the BDSs can trigger an aio_poll() and wake
4a2fec
up other jobs that might attempt to use the block job list. If that
4a2fec
happens the job we're currently destroying should not be in that list
4a2fec
anymore.
4a2fec
4a2fec
Signed-off-by: Alberto Garcia <berto@igalia.com>
4a2fec
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4a2fec
(cherry picked from commit 0a3e155f3f5ec9b6f12d00894c7701b3cbb66590)
4a2fec
Signed-off-by: Jeff Cody <jcody@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 blockjob.c | 2 +-
4a2fec
 1 file changed, 1 insertion(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/blockjob.c b/blockjob.c
4a2fec
index c3cf9a2..2509bba 100644
4a2fec
--- a/blockjob.c
4a2fec
+++ b/blockjob.c
4a2fec
@@ -152,6 +152,7 @@ void block_job_unref(BlockJob *job)
4a2fec
 {
4a2fec
     if (--job->refcnt == 0) {
4a2fec
         BlockDriverState *bs = blk_bs(job->blk);
4a2fec
+        QLIST_REMOVE(job, job_list);
4a2fec
         bs->job = NULL;
4a2fec
         block_job_remove_all_bdrv(job);
4a2fec
         blk_remove_aio_context_notifier(job->blk,
4a2fec
@@ -160,7 +161,6 @@ void block_job_unref(BlockJob *job)
4a2fec
         blk_unref(job->blk);
4a2fec
         error_free(job->blocker);
4a2fec
         g_free(job->id);
4a2fec
-        QLIST_REMOVE(job, job_list);
4a2fec
         g_free(job);
4a2fec
     }
4a2fec
 }
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec