diff options
author | Fam Zheng | 2017-04-07 02:55:13 +0200 |
---|---|---|
committer | Fam Zheng | 2017-04-11 14:07:15 +0200 |
commit | d90fce944647f8b2759f016b0f86bf36dffe34c8 (patch) | |
tree | 4e4fcebe0f121b03eef522cf31236b16e0e204ca /tests | |
parent | block: Quiesce old aio context during bdrv_set_aio_context (diff) | |
download | qemu-d90fce944647f8b2759f016b0f86bf36dffe34c8.tar.gz qemu-d90fce944647f8b2759f016b0f86bf36dffe34c8.tar.xz qemu-d90fce944647f8b2759f016b0f86bf36dffe34c8.zip |
tests/block-job-txn: Don't start block job before adding to txn
Previously, before test_block_job_start returns, the job can already
complete, as a result, the transactional state of other jobs added to
the same txn later cannot be handled correctly.
Move the block_job_start() calls to callers after
block_job_txn_add_job() calls.
Signed-off-by: Fam Zheng <famz@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-blockjob-txn.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index 4ccbda14af..0f80194e85 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -110,7 +110,6 @@ static BlockJob *test_block_job_start(unsigned int iterations, s->result = result; data->job = s; data->result = result; - block_job_start(&s->common); return &s->common; } @@ -123,6 +122,7 @@ static void test_single_job(int expected) txn = block_job_txn_new(); job = test_block_job_start(1, true, expected, &result); block_job_txn_add_job(txn, job); + block_job_start(job); if (expected == -ECANCELED) { block_job_cancel(job); @@ -164,6 +164,8 @@ static void test_pair_jobs(int expected1, int expected2) block_job_txn_add_job(txn, job1); job2 = test_block_job_start(2, true, expected2, &result2); block_job_txn_add_job(txn, job2); + block_job_start(job1); + block_job_start(job2); if (expected1 == -ECANCELED) { block_job_cancel(job1); @@ -223,6 +225,8 @@ static void test_pair_jobs_fail_cancel_race(void) block_job_txn_add_job(txn, job1); job2 = test_block_job_start(2, false, 0, &result2); block_job_txn_add_job(txn, job2); + block_job_start(job1); + block_job_start(job2); block_job_cancel(job1); |