]> git.proxmox.com Git - mirror_qemu.git/commitdiff
blockjob: Fix coroutine thread after AioContext change
authorKevin Wolf <kwolf@redhat.com>
Fri, 3 May 2019 17:17:43 +0000 (19:17 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 10 May 2019 14:45:40 +0000 (16:45 +0200)
Commit 463e0be10 ('blockjob: add AioContext attached callback') tried to
make block jobs robust against AioContext changes of their main node,
but it never made sure that the job coroutine actually runs in the new
thread.

Instead of waking up the job coroutine in whatever thread it ran before,
let's always pass the AioContext where it should be running now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
job.c

diff --git a/job.c b/job.c
index da8e4b7bf2f35ea26262af612b51c7a7f5f72f8d..2167d537179e735916268cdfa70ac4b53652fafc 100644 (file)
--- a/job.c
+++ b/job.c
@@ -432,7 +432,7 @@ void job_enter_cond(Job *job, bool(*fn)(Job *job))
     timer_del(&job->sleep_timer);
     job->busy = true;
     job_unlock();
-    aio_co_wake(job->co);
+    aio_co_enter(job->aio_context, job->co);
 }
 
 void job_enter(Job *job)