From: Lukas Straub <lukasstraub2@web.de>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block <qemu-block@nongnu.org>,
Wen Congyang <wencongyang2@huawei.com>,
Xie Changlong <xiechanglong.d@gmail.com>,
Max Reitz <mreitz@redhat.com>
Subject: [PATCH v5 4/5] replication: Assert that children are writable
Date: Mon, 12 Jul 2021 13:54:09 +0200 [thread overview]
Message-ID: <360083cb9c08e364eb99e232b2705226b23f4503.1626090553.git.lukasstraub2@web.de> (raw)
In-Reply-To: <cover.1626090553.git.lukasstraub2@web.de>
[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]
Assert that the children are writable where it's needed.
While there is no test-case for the
BLOCK_REPLICATION_FAILOVER_FAILED state, this at least ensures that
s->secondary_disk is always writable in case replication might go
into that state.
Signed-off-by: Lukas Straub <lukasstraub2@web.de>
---
block/replication.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/replication.c b/block/replication.c
index b74192f795..772bb63374 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -261,6 +261,13 @@ static coroutine_fn int replication_co_writev(BlockDriverState *bs,
int64_t n;
assert(!flags);
+ assert(top->perm & BLK_PERM_WRITE);
+ if (s->mode == REPLICATION_MODE_SECONDARY &&
+ s->stage != BLOCK_REPLICATION_NONE &&
+ s->stage != BLOCK_REPLICATION_DONE) {
+ assert(base->perm & BLK_PERM_WRITE);
+ }
+
ret = replication_get_io_status(s);
if (ret < 0) {
goto out;
@@ -318,6 +325,9 @@ static void secondary_do_checkpoint(BlockDriverState *bs, Error **errp)
Error *local_err = NULL;
int ret;
+ assert(active_disk->perm & BLK_PERM_WRITE);
+ assert(s->hidden_disk->perm & BLK_PERM_WRITE);
+
if (!s->backup_job) {
error_setg(errp, "Backup job was cancelled unexpectedly");
return;
--
2.20.1
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-07-12 11:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-12 11:53 [PATCH v5 0/5] replication: Bugfix and properly attach children Lukas Straub
2021-07-12 11:53 ` [PATCH v5 1/5] replication: Remove s->active_disk Lukas Straub
2021-07-12 11:54 ` [PATCH v5 2/5] replication: Reduce usage of s->hidden_disk and s->secondary_disk Lukas Straub
2021-07-12 11:54 ` [PATCH v5 3/5] replication: Properly attach children Lukas Straub
2021-07-12 11:54 ` Lukas Straub [this message]
2021-07-15 13:17 ` [PATCH v5 4/5] replication: Assert that children are writable Vladimir Sementsov-Ogievskiy
2021-07-12 11:54 ` [PATCH v5 5/5] replication: Remove workaround Lukas Straub
2021-07-15 13:48 ` Vladimir Sementsov-Ogievskiy
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=360083cb9c08e364eb99e232b2705226b23f4503.1626090553.git.lukasstraub2@web.de \
--to=lukasstraub2@web.de \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.com \
/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).