diff options
author | Peter Maydell | 2017-11-21 18:05:49 +0100 |
---|---|---|
committer | Peter Maydell | 2017-11-21 18:05:49 +0100 |
commit | 64807cd77938885f681a9a18b5736e923ad50b7c (patch) | |
tree | 7785670f2bc440477c5727b73766685017f6feee /blockjob.c | |
parent | Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (diff) | |
parent | qemu-iotest: add test for blockjob coroutine race condition (diff) | |
download | qemu-64807cd77938885f681a9a18b5736e923ad50b7c.tar.gz qemu-64807cd77938885f681a9a18b5736e923ad50b7c.tar.xz qemu-64807cd77938885f681a9a18b5736e923ad50b7c.zip |
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
# gpg: Signature made Tue 21 Nov 2017 17:01:33 GMT
# gpg: using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg: aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg: aka "Jeffrey Cody <codyprime@gmail.com>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98 D624 BDBE 7B27 C0DE 3057
* remotes/cody/tags/block-pull-request:
qemu-iotest: add test for blockjob coroutine race condition
qemu-iotests: add option in common.qemu for mismatch only
coroutine: abort if we try to schedule or enter a pending coroutine
blockjob: do not allow coroutine double entry or entry-after-completion
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'blockjob.c')
-rw-r--r-- | blockjob.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/blockjob.c b/blockjob.c index 3a0c49137e..ff9a614531 100644 --- a/blockjob.c +++ b/blockjob.c @@ -797,11 +797,14 @@ void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns) return; } - job->busy = false; + /* We need to leave job->busy set here, because when we have + * put a coroutine to 'sleep', we have scheduled it to run in + * the future. We cannot enter that same coroutine again before + * it wakes and runs, otherwise we risk double-entry or entry after + * completion. */ if (!block_job_should_pause(job)) { co_aio_sleep_ns(blk_get_aio_context(job->blk), type, ns); } - job->busy = true; block_job_pause_point(job); } |