First, it's redundant to have each job manage this itself. Second, doing so allows us to remove a tricky case where the completion code is called under an aio_context lock, which then calls the finalization code which is itself executed under a second aio_context lock.
Removing this recursive lock acquisition is necessary for converting mirror to only modify its graph post-finalization, but it's also just safer and will bite us less in the future. This series introduces a .job_exit callback, but after jobs are fully transitioned to using the .commit/.abort callbacks, this new completion callback will be removed. John Snow (7): jobs: change start callback to run callback jobs: canonize Error object jobs: add exit shim block/commit: utilize job_exit shim block/mirror: utilize job_exit shim jobs: utilize job_exit shim jobs: remove job_defer_to_main_loop block/backup.c | 23 +++------------- block/commit.c | 27 ++++++------------- block/create.c | 19 +++++-------- block/mirror.c | 35 +++++++++++------------- block/stream.c | 29 ++++++++------------ include/qemu/job.h | 36 +++++++++---------------- job-qmp.c | 5 ++-- job.c | 68 +++++++++++++++-------------------------------- tests/test-bdrv-drain.c | 13 +++------ tests/test-blockjob-txn.c | 25 +++++++---------- tests/test-blockjob.c | 17 ++++++------ 11 files changed, 102 insertions(+), 195 deletions(-) -- 2.14.4