job_cancel_sync requires the job's lock to be held, all other callers already do this (replication_stop, drive_backup_abort, blockdev_backup_abort, job_cancel_sync_all, cancel_common).
Signed-off-by: Stefan Reiter <s.rei...@proxmox.com> --- block/replication.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/replication.c b/block/replication.c index 413d95407d..6c809cda4e 100644 --- a/block/replication.c +++ b/block/replication.c @@ -144,12 +144,16 @@ fail: static void replication_close(BlockDriverState *bs) { BDRVReplicationState *s = bs->opaque; + Job *commit_job = &s->commit_job->job; + AioContext *commit_ctx = commit_job->aio_context; if (s->stage == BLOCK_REPLICATION_RUNNING) { replication_stop(s->rs, false, NULL); } if (s->stage == BLOCK_REPLICATION_FAILOVER) { - job_cancel_sync(&s->commit_job->job); + aio_context_acquire(commit_ctx); + job_cancel_sync(commit_job); + aio_context_release(commit_ctx); } if (s->mode == REPLICATION_MODE_SECONDARY) { -- 2.26.0