summary refs log tree commit diff stats
path: root/job.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-09-12 13:50:38 +0200
committerKevin Wolf <kwolf@redhat.com>2018-09-25 15:50:15 +0200
commitd1756c780b7879fb64e41135feac781d84a1f995 (patch)
tree56ed165e51777fa0e1bddc296ee98f52e70de1d1 /job.c
parent49880165a44f26dc84651858750facdee31f2513 (diff)
downloadfocaccia-qemu-d1756c780b7879fb64e41135feac781d84a1f995.tar.gz
focaccia-qemu-d1756c780b7879fb64e41135feac781d84a1f995.zip
job: Fix missing locking due to mismerge
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>
Diffstat (limited to 'job.c')
-rw-r--r--job.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/job.c b/job.c
index 3dd31a5f8e..d17b1c82da 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);
 }
 
 /**