Skip to content

Commit

Permalink
replication: assert we own context before job_cancel_sync
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
PiMaker authored and kevmw committed Apr 7, 2020
1 parent b660a84 commit 08558e3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion block/replication.c
Expand Up @@ -144,12 +144,15 @@ static int replication_open(BlockDriverState *bs, QDict *options,
static void replication_close(BlockDriverState *bs)
{
BDRVReplicationState *s = bs->opaque;
Job *commit_job;

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);
commit_job = &s->commit_job->job;
assert(commit_job->aio_context == qemu_get_current_aio_context());
job_cancel_sync(commit_job);
}

if (s->mode == REPLICATION_MODE_SECONDARY) {
Expand Down

0 comments on commit 08558e3

Please sign in to comment.