]> Git Repo - qemu.git/commitdiff
replication: assert we own context before job_cancel_sync
authorStefan Reiter <[email protected]>
Tue, 7 Apr 2020 11:56:50 +0000 (13:56 +0200)
committerKevin Wolf <[email protected]>
Tue, 7 Apr 2020 12:34:47 +0000 (14:34 +0200)
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 <[email protected]>
Message-Id: <20200407115651[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/replication.c

index 413d95407d94737f0b48253a0b12df615adaa8a0..da013c20411acdf90fbb65655f177f1a1f365519 100644 (file)
@@ -144,12 +144,15 @@ fail:
 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) {
This page took 0.027645 seconds and 4 git commands to generate.