qemu-kvm/0081-job-Fix-missing-lockin...

56 lines
1.6 KiB
Diff

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