From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 2/7] replication: assert we own context before job_cancel_sync
Date: Tue, 7 Apr 2020 16:26:11 +0200 [thread overview]
Message-ID: <20200407142616.7961-3-kwolf@redhat.com> (raw)
In-Reply-To: <20200407142616.7961-1-kwolf@redhat.com>
From: Stefan Reiter <s.reiter@proxmox.com>
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>
---
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
next prev parent reply other threads:[~2020-04-07 14:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-07 14:26 [PULL 0/7] Block layer patches Kevin Wolf
2020-04-07 14:26 ` [PULL 1/7] job: take each job's lock individually in job_txn_apply Kevin Wolf
2020-04-07 14:26 ` Kevin Wolf [this message]
2020-04-07 14:26 ` [PULL 3/7] backup: don't acquire aio_context in backup_clean Kevin Wolf
2020-04-07 14:26 ` [PULL 4/7] block-backend: Reorder flush/pdiscard function definitions Kevin Wolf
2020-04-07 14:26 ` [PULL 5/7] block: Increase BB.in_flight for coroutine and sync interfaces Kevin Wolf
2020-04-07 14:26 ` [PULL 6/7] block: Fix blk->in_flight during blk_wait_while_drained() Kevin Wolf
2020-04-07 14:26 ` [PULL 7/7] vpc: Don't round up already aligned BAT sizes Kevin Wolf
2020-04-07 19:54 ` [PULL 0/7] Block layer patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200407142616.7961-3-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).