qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

replication: assert we own context before job_cancel_sync

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).

In this case we're in a BlockDriver handler, so we already have a lock,
just assert that it is the same as the one used for the commit_job.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Message-Id: <20200407115651.69472-3-s.reiter@proxmox.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

authored by

Stefan Reiter and committed by
Kevin Wolf
08558e33 b660a84b

+4 -1
+4 -1
block/replication.c
··· 144 144 static void replication_close(BlockDriverState *bs) 145 145 { 146 146 BDRVReplicationState *s = bs->opaque; 147 + Job *commit_job; 147 148 148 149 if (s->stage == BLOCK_REPLICATION_RUNNING) { 149 150 replication_stop(s->rs, false, NULL); 150 151 } 151 152 if (s->stage == BLOCK_REPLICATION_FAILOVER) { 152 - job_cancel_sync(&s->commit_job->job); 153 + commit_job = &s->commit_job->job; 154 + assert(commit_job->aio_context == qemu_get_current_aio_context()); 155 + job_cancel_sync(commit_job); 153 156 } 154 157 155 158 if (s->mode == REPLICATION_MODE_SECONDARY) {