From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com,
crosa@redhat.com, ehabkost@redhat.com, den@openvz.org,
jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/3] qcow2: handle reopening bitmaps on bdrv_invalidate_cache
Date: Fri, 22 Dec 2017 16:43:18 +0100 [thread overview]
Message-ID: <20171222154318.GK3763@localhost.localdomain> (raw)
In-Reply-To: <25bbf12b-e6e8-29be-c28e-1bd10a9dd473@virtuozzo.com>
Am 22.12.2017 um 15:25 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 22.12.2017 16:39, Kevin Wolf wrote:
> > Am 12.12.2017 um 17:04 hat Vladimir Sementsov-Ogievskiy geschrieben:
> > > Consider migration with shared storage. Persistent bitmaps are stored
> > > on bdrv_inactivate. Then, on destination
> > > process_incoming_migration_bh() calls bdrv_invalidate_cache_all() which
> > > leads to qcow2_load_autoloading_dirty_bitmaps() which fails if bitmaps
> > > are already loaded on destination start. In this case we should call
> > > qcow2_reopen_bitmaps_rw instead.
> > >
> > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> > > Reviewed-by: John Snow <jsnow@redhat.com>
> > qcow2_invalidate_cache() calls qcow2_close() first, so why are there
> > still any bitmaps loaded? Isn't this a bug? Do we leak bitmaps when a
> > qcow2 image is closed?
> >
> > Kevin
>
> Interesting point.
>
> Now persistent dirty bitmaps are released at the end of
> bdrv_inactivate_recurse,
> which is not called here. It was a separate patch
>
> commit 615b5dcf2decbc5f0abb512d13d7e5db2385fa23
> Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Date: Wed Jun 28 15:05:30 2017 +0300
>
> block: release persistent bitmaps on inactivate
>
> May be it is more correct to release them immediately after storing, in
> qcow2_inactivete.
I chose the question form because I'm really not deep enough into the
bitmap code to have a solid opinion, but I have a feeling that releasing
the bitmaps from the block driver that provided them would be cleaner
indeed. I suppose the same is true for .bdrv_close.
> But it will not fix the issue, because qcow2_close will
> call qcow2_inactivate only if (!(s->flags & BDRV_O_INACTIVE)), but it is
> not the case.
Yes, good point.
Is there a reason why bitmaps are already loaded in qcow2_do_open() even
if the image is inactive? Can bitmaps be meaningfully used on inactive
images?
Otherwise, we could just make qcow2_load_autoloading_dirty_bitmaps()
conditional on cleared BDRV_O_INACTIVE.
> or we can do like this, it fixes the new test:
> static void qcow2_close(BlockDriverState *bs)
> {
> BDRVQcow2State *s = bs->opaque;
> qemu_vfree(s->l1_table);
> /* else pre-write overlap checks in cache_destroy may crash */
> s->l1_table = NULL;
>
> if (!(s->flags & BDRV_O_INACTIVE)) {
> qcow2_inactivate(bs);
> }
> + bdrv_release_persistent_dirty_bitmaps(bs);
>
> What do you think?
Hm, I think I don't like this much.
We just need to decide what the status of inactive images is supposed to
be. If they should have bitmaps, then your patch is probably right. But
if inactive images shouldn't have any, we need to change qcow2_do_open()
and qcow2_inactivate().
Kevin
next prev parent reply other threads:[~2017-12-22 15:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 16:04 [Qemu-devel] [PATCH v2 0/3] fix bitmaps migration through shared storage Vladimir Sementsov-Ogievskiy
2017-12-12 16:04 ` [Qemu-devel] [PATCH v2 1/3] qcow2-bitmap: add qcow2_reopen_bitmaps_rw_hint() Vladimir Sementsov-Ogievskiy
2017-12-12 16:04 ` [Qemu-devel] [PATCH v2 2/3] qcow2: handle reopening bitmaps on bdrv_invalidate_cache Vladimir Sementsov-Ogievskiy
2017-12-22 13:39 ` Kevin Wolf
2017-12-22 14:25 ` Vladimir Sementsov-Ogievskiy
2017-12-22 15:43 ` Kevin Wolf [this message]
2017-12-22 16:12 ` Vladimir Sementsov-Ogievskiy
2017-12-22 16:28 ` Kevin Wolf
2018-01-10 12:52 ` Vladimir Sementsov-Ogievskiy
2017-12-12 16:04 ` [Qemu-devel] [PATCH v2 3/3] iotests: add dirty bitmap migration test Vladimir Sementsov-Ogievskiy
2017-12-22 13:43 ` Kevin Wolf
2017-12-22 13:53 ` Vladimir Sementsov-Ogievskiy
2017-12-20 14:05 ` [Qemu-devel] [PATCH v2 0/3] fix bitmaps migration through shared storage 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=20171222154318.GK3763@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=crosa@redhat.com \
--cc=den@openvz.org \
--cc=ehabkost@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).