cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
ae23c9
From f842ac5501037ccea54e3b6c8a7a2471b30aaea7 Mon Sep 17 00:00:00 2001
ae23c9
From: Kevin Wolf <kwolf@redhat.com>
ae23c9
Date: Wed, 10 Oct 2018 20:21:55 +0100
ae23c9
Subject: [PATCH 29/49] job: Fix missing locking due to mismerge
ae23c9
ae23c9
RH-Author: Kevin Wolf <kwolf@redhat.com>
ae23c9
Message-id: <20181010202213.7372-17-kwolf@redhat.com>
ae23c9
Patchwork-id: 82607
ae23c9
O-Subject: [RHEL-8 qemu-kvm PATCH 26/44] job: Fix missing locking due to mismerge
ae23c9
Bugzilla: 1637976
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: John Snow <jsnow@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
ae23c9
job_completed() had a problem with double locking that was recently
ae23c9
fixed independently by two different commits:
ae23c9
ae23c9
"job: Fix nested aio_poll() hanging in job_txn_apply"
ae23c9
"jobs: add exit shim"
ae23c9
ae23c9
One fix removed the first aio_context_acquire(), the other fix removed
ae23c9
the other one. Now we have a bug again and the code is run without any
ae23c9
locking.
ae23c9
ae23c9
Add it back in one of the places.
ae23c9
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Reviewed-by: Max Reitz <mreitz@redhat.com>
ae23c9
Reviewed-by: John Snow <jsnow@redhat.com>
ae23c9
(cherry picked from commit d1756c780b7879fb64e41135feac781d84a1f995)
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 job.c | 4 ++++
ae23c9
 1 file changed, 4 insertions(+)
ae23c9
ae23c9
diff --git a/job.c b/job.c
ae23c9
index 5d117fb..db53163 100644
ae23c9
--- a/job.c
ae23c9
+++ b/job.c
ae23c9
@@ -842,7 +842,11 @@ static void job_completed(Job *job)
ae23c9
 static void job_exit(void *opaque)
ae23c9
 {
ae23c9
     Job *job = (Job *)opaque;
ae23c9
+    AioContext *ctx = job->aio_context;
ae23c9
+
ae23c9
+    aio_context_acquire(ctx);
ae23c9
     job_completed(job);
ae23c9
+    aio_context_release(ctx);
ae23c9
 }
ae23c9
 
ae23c9
 /**
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9