[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/7] replication: assert we own context before job_cancel_sync
From: |
Kevin Wolf |
Subject: |
[PULL 2/7] replication: assert we own context before job_cancel_sync |
Date: |
Tue, 7 Apr 2020 16:26:11 +0200 |
From: Stefan Reiter <address@hidden>
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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/replication.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/block/replication.c b/block/replication.c
index 413d95407d..da013c2041 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -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) {
--
2.20.1
- [PULL 0/7] Block layer patches, Kevin Wolf, 2020/04/07
- [PULL 1/7] job: take each job's lock individually in job_txn_apply, Kevin Wolf, 2020/04/07
- [PULL 4/7] block-backend: Reorder flush/pdiscard function definitions, Kevin Wolf, 2020/04/07
- [PULL 5/7] block: Increase BB.in_flight for coroutine and sync interfaces, Kevin Wolf, 2020/04/07
- [PULL 6/7] block: Fix blk->in_flight during blk_wait_while_drained(), Kevin Wolf, 2020/04/07
- [PULL 7/7] vpc: Don't round up already aligned BAT sizes, Kevin Wolf, 2020/04/07
- [PULL 3/7] backup: don't acquire aio_context in backup_clean, Kevin Wolf, 2020/04/07
- [PULL 2/7] replication: assert we own context before job_cancel_sync,
Kevin Wolf <=
- Re: [PULL 0/7] Block layer patches, Peter Maydell, 2020/04/07