From: Lukas Straub <lukasstraub2@web.de>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block <qemu-block@nongnu.org>,
Wen Congyang <wencongyang2@huawei.com>,
Xie Changlong <xiechanglong.d@gmail.com>,
qemu-devel <qemu-devel@nongnu.org>, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH v3 4/4] replication: Remove workaround
Date: Mon, 12 Jul 2021 13:12:07 +0200 [thread overview]
Message-ID: <20210712131207.59b03db9@gecko.fritz.box> (raw)
In-Reply-To: <3dfeee12-4803-36fe-504a-77537e8ebad7@virtuozzo.com>
[-- Attachment #1: Type: text/plain, Size: 3470 bytes --]
On Mon, 12 Jul 2021 13:06:19 +0300
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> wrote:
> 11.07.2021 23:33, Lukas Straub wrote:
> > On Fri, 9 Jul 2021 10:49:23 +0300
> > Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> wrote:
> >
> >> 07.07.2021 21:15, Lukas Straub wrote:
> >>> Remove the workaround introduced in commit
> >>> 6ecbc6c52672db5c13805735ca02784879ce8285
> >>> "replication: Avoid blk_make_empty() on read-only child".
> >>>
> >>> It is not needed anymore since s->hidden_disk is guaranteed to be
> >>> writable when secondary_do_checkpoint() runs. Because replication_start(),
> >>> _do_checkpoint() and _stop() are only called by COLO migration code
> >>> and COLO-migration doesn't inactivate disks.
> >>
> >> If look at replication_child_perm() you should also be sure that it always works only with RW disks..
> >>
> >> Actually, I think that it would be correct just require BLK_PERM_WRITE in replication_child_perm() unconditionally. Let generic layer care about all these RD/WR things. In _child_perm() we can require WRITE and don't care. If something goes wrong and we can't get WRITE permission we should see clean error-out.
> >>
> >> Opposite, if we don't require WRITE permission in some case and still do WRITE request, it may crash.
> >>
> >> Still, this may be considered as a preexisting problem of replication_child_perm() and fixed separately.
> >
> > Hmm, unconditionally requesting write doesn't work, since qemu on the
> > secondary side is started with "-miration incoming", it goes into
> > runstate RUN_STATE_INMIGRATE from the beginning and then blockdev_init()
> > opens every blockdev with BDRV_O_INACTIVE and then it errors out with
> > -drive driver=replication,...: Block node is read-only.
>
> Ah, OK. So we need this check in _child_perm().. Then, maybe, leave check or assertion in secondary_do_checkpoint, that hidden_disk is writable?
Good Idea. I will add assertions to secondary_do_checkpoint and replication_co_writev too.
> >
> >>>
> >>> Signed-off-by: Lukas Straub <lukasstraub2@web.de>
> >>
> >> So, for this one commit (with probably updated commit message accordingly to my comments, or even rebased on fixed replication_child_perm()):
> >>
> >> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> >>
> >>
> >>> ---
> >>> block/replication.c | 12 +-----------
> >>> 1 file changed, 1 insertion(+), 11 deletions(-)
> >>>
> >>> diff --git a/block/replication.c b/block/replication.c
> >>> index c0d4a6c264..68b46d65a8 100644
> >>> --- a/block/replication.c
> >>> +++ b/block/replication.c
> >>> @@ -348,17 +348,7 @@ static void secondary_do_checkpoint(BlockDriverState *bs, Error **errp)
> >>> return;
> >>> }
> >>>
> >>> - BlockBackend *blk = blk_new(qemu_get_current_aio_context(),
> >>> - BLK_PERM_WRITE, BLK_PERM_ALL);
> >>> - blk_insert_bs(blk, s->hidden_disk->bs, &local_err);
> >>> - if (local_err) {
> >>> - error_propagate(errp, local_err);
> >>> - blk_unref(blk);
> >>> - return;
> >>> - }
> >>> -
> >>> - ret = blk_make_empty(blk, errp);
> >>> - blk_unref(blk);
> >>> + ret = bdrv_make_empty(s->hidden_disk, errp);
> >>> if (ret < 0) {
> >>> return;
> >>> }
> >>> --
> >>> 2.20.1
> >>>
> >>
> >>
> >
> >
> >
>
>
--
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2021-07-12 11:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 18:15 [PATCH v3 0/4] replication: Properly attach children Lukas Straub
2021-07-07 18:15 ` [PATCH v3 1/4] replication: Remove s->active_disk Lukas Straub
2021-07-09 7:11 ` Vladimir Sementsov-Ogievskiy
2021-07-09 12:11 ` Lukas Straub
2021-07-07 18:15 ` [PATCH v3 2/4] replication: Reduce usage of s->hidden_disk and s->secondary_disk Lukas Straub
2021-07-09 7:20 ` Vladimir Sementsov-Ogievskiy
2021-07-07 18:15 ` [PATCH v3 3/4] replication: Properly attach children Lukas Straub
2021-07-09 7:41 ` Vladimir Sementsov-Ogievskiy
2021-07-07 18:15 ` [PATCH v3 4/4] replication: Remove workaround Lukas Straub
2021-07-09 7:49 ` Vladimir Sementsov-Ogievskiy
2021-07-11 20:33 ` Lukas Straub
2021-07-12 10:06 ` Vladimir Sementsov-Ogievskiy
2021-07-12 11:12 ` Lukas Straub [this message]
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=20210712131207.59b03db9@gecko.fritz.box \
--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).