diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-08-17 17:29:08 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-09-25 15:50:15 +0200 |
commit | 30c070a547322a5e41ce129d540bca3653b1a9c8 (patch) | |
tree | b23c83d6c288b8c8cf1c15d6bf2c81f10518aa4b /tests/test-blockjob.c | |
parent | f62c172959cd2b6de4dd8ba782e855d64d94764b (diff) |
test-blockjob: Acquire AioContext around job_cancel_sync()
All callers in QEMU proper hold the AioContext lock when calling
job_finish_sync(). test-blockjob should do the same when it calls the
function indirectly through job_cancel_sync().
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'tests/test-blockjob.c')
-rw-r--r-- | tests/test-blockjob.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index de4c1c20aa..652d1e8359 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -223,6 +223,10 @@ static void cancel_common(CancelJob *s) BlockJob *job = &s->common; BlockBackend *blk = s->blk; JobStatus sts = job->job.status; + AioContext *ctx; + + ctx = job->job.aio_context; + aio_context_acquire(ctx); job_cancel_sync(&job->job); if (sts != JOB_STATUS_CREATED && sts != JOB_STATUS_CONCLUDED) { @@ -232,6 +236,8 @@ static void cancel_common(CancelJob *s) assert(job->job.status == JOB_STATUS_NULL); job_unref(&job->job); destroy_blk(blk); + + aio_context_release(ctx); } static void test_cancel_created(void) |