aboutsummaryrefslogtreecommitdiff
path: root/include/block/blockjob_int.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-11-29 11:25:13 +0100
committerKevin Wolf <kwolf@redhat.com>2017-11-29 15:26:21 +0100
commitfc24908e7d232b79c2a6f0363f52bda18dedb57b (patch)
treec9845836381e9ca9745e01b7e3e00c820dee6af3 /include/block/blockjob_int.h
parent356f59b8757f47c0aca3e2e4e51d6010f64cade1 (diff)
blockjob: reimplement block_job_sleep_ns to allow cancellation
This reverts the effects of commit 4afeffc857 ("blockjob: do not allow coroutine double entry or entry-after-completion", 2017-11-21) This fixed the symptom of a bug rather than the root cause. Canceling the wait on a sleeping blockjob coroutine is generally fine, we just need to make it work correctly across AioContexts. To do so, use a QEMUTimer that calls block_job_enter. Use a mutex to ensure that block_job_enter synchronizes correctly with block_job_sleep_ns. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-By: Jeff Cody <jcody@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block/blockjob_int.h')
-rw-r--r--include/block/blockjob_int.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
index f7ab183a39..c9b23b0cc9 100644
--- a/include/block/blockjob_int.h
+++ b/include/block/blockjob_int.h
@@ -142,8 +142,8 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
* @ns: How many nanoseconds to stop for.
*
* Put the job to sleep (assuming that it wasn't canceled) for @ns
- * %QEMU_CLOCK_REALTIME nanoseconds. Canceling the job will not interrupt
- * the wait, so the cancel will not process until the coroutine wakes up.
+ * %QEMU_CLOCK_REALTIME nanoseconds. Canceling the job will immediately
+ * interrupt the wait.
*/
void block_job_sleep_ns(BlockJob *job, int64_t ns);