There are a few problems with transactional job completion right now. First, if jobs complete so quickly they complete before remaining jobs get a chance to join the transaction, the completion mode can leave well known state and the QLIST can get corrupted and the transactional jobs can complete in batches or phases instead of all together.
Second, if two or more jobs defer to the main loop at roughly the same time, it's possible for one job's cleanup to directly invoke the other job's cleanup from within the same thread, leading to a situation that will deadlock the entire transaction. Thanks to Vladimir for pointing out these modes of failure. ________________________________________________________________________________ For convenience, this branch is available at: https://github.com/jnsnow/qemu.git branch job-manual-start https://github.com/jnsnow/qemu/tree/job-manual-start This version is tagged job-manual-start-v1: https://github.com/jnsnow/qemu/releases/tag/job-manual-start-v1 John Snow (4): blockjob: add block_job_start blockjob: refactor backup_start as backup_job_create blockjob: add .clean property iotests: add transactional failure race test Vladimir Sementsov-Ogievskiy (1): blockjob: fix dead pointer in txn list block/backup.c | 50 +++++++----- block/commit.c | 2 +- block/mirror.c | 2 +- block/stream.c | 2 +- blockdev.c | 194 ++++++++++++++++++++++++++------------------- blockjob.c | 24 +++++- include/block/block_int.h | 19 ++--- include/block/blockjob.h | 16 ++++ tests/qemu-iotests/124 | 91 +++++++++++++++++++++ tests/qemu-iotests/124.out | 4 +- tests/test-blockjob-txn.c | 2 +- 11 files changed, 284 insertions(+), 122 deletions(-) -- 2.7.4