Blame SOURCES/kvm-replication-assert-we-own-context-before-job_cancel_.patch

22c213
From 46887feac666d0d7633ff3f5af5721fe2a80a8ab Mon Sep 17 00:00:00 2001
22c213
From: Kevin Wolf <kwolf@redhat.com>
22c213
Date: Wed, 8 Apr 2020 17:29:13 +0100
22c213
Subject: [PATCH 2/6] replication: assert we own context before job_cancel_sync
22c213
22c213
RH-Author: Kevin Wolf <kwolf@redhat.com>
22c213
Message-id: <20200408172917.18712-3-kwolf@redhat.com>
22c213
Patchwork-id: 94595
22c213
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 2/6] replication: assert we own context before job_cancel_sync
22c213
Bugzilla: 1817621
22c213
RH-Acked-by: Eric Blake <eblake@redhat.com>
22c213
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
22c213
RH-Acked-by: Max Reitz <mreitz@redhat.com>
22c213
22c213
From: Stefan Reiter <s.reiter@proxmox.com>
22c213
22c213
job_cancel_sync requires the job's lock to be held, all other callers
22c213
already do this (replication_stop, drive_backup_abort,
22c213
blockdev_backup_abort, job_cancel_sync_all, cancel_common).
22c213
22c213
In this case we're in a BlockDriver handler, so we already have a lock,
22c213
just assert that it is the same as the one used for the commit_job.
22c213
22c213
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
22c213
Message-Id: <20200407115651.69472-3-s.reiter@proxmox.com>
22c213
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22c213
(cherry picked from commit 08558e33257ec796594bd411261028a93414a70c)
22c213
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 block/replication.c | 5 ++++-
22c213
 1 file changed, 4 insertions(+), 1 deletion(-)
22c213
22c213
diff --git a/block/replication.c b/block/replication.c
22c213
index 99532ce..0ce27ee 100644
22c213
--- a/block/replication.c
22c213
+++ b/block/replication.c
22c213
@@ -144,12 +144,15 @@ fail:
22c213
 static void replication_close(BlockDriverState *bs)
22c213
 {
22c213
     BDRVReplicationState *s = bs->opaque;
22c213
+    Job *commit_job;
22c213
 
22c213
     if (s->stage == BLOCK_REPLICATION_RUNNING) {
22c213
         replication_stop(s->rs, false, NULL);
22c213
     }
22c213
     if (s->stage == BLOCK_REPLICATION_FAILOVER) {
22c213
-        job_cancel_sync(&s->commit_job->job);
22c213
+        commit_job = &s->commit_job->job;
22c213
+        assert(commit_job->aio_context == qemu_get_current_aio_context());
22c213
+        job_cancel_sync(commit_job);
22c213
     }
22c213
 
22c213
     if (s->mode == REPLICATION_MODE_SECONDARY) {
22c213
-- 
22c213
1.8.3.1
22c213