From: Stefan Hajnoczi <stefanha@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH] block/migration: Disable cache invalidate for incoming migration
Date: Mon, 6 Oct 2014 11:03:36 +0100 [thread overview]
Message-ID: <20141006100336.GE2694@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <542E2216.2040100@ozlabs.ru>
[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]
On Fri, Oct 03, 2014 at 02:12:06PM +1000, Alexey Kardashevskiy wrote:
> BDRV_O_INCOMING is only set when QEMU is about to receive migration and
> we do not want QEMU to check the file at opening time as there is likely
> garbage. Is there any other use of BDRV_O_INCOMING? There must be some as
> bdrv_clear_incoming_migration_all() is called at the end of live
> migration and I believe there must be a reason for it (cache does not
> migrate, does it?).
BDRV_O_INCOMING is just for live migration. The cached data is not
migrated, this is why it must be refreshed upon migration handover.
> bdrv_invalidate_cache() flushes cache as it could be already initialized
> even if QEMU is receiving migration - QEMU could have cached some of real
> disk data. Is that correct? I do not really understand why it would
> happen if there is BDRV_O_INCOMING set but ok.
.bdrv_open() can load metadata from image files (such as the qcow2 L1
tables) and it does this even when BDRV_O_INCOMING is set. That data
needs to be re-read at migration handover to prevent the destination
QEMU from running with stale image metadata.
> diff --git a/nbd.c b/nbd.c
> index e9b539b..953c378 100644
> - --- a/nbd.c
> +++ b/nbd.c
> @@ -972,6 +972,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t
> dev_offset,
> exp->ctx = bdrv_get_aio_context(bs);
> bdrv_ref(bs);
> bdrv_add_aio_context_notifier(bs, bs_aio_attached, bs_aio_detach, exp);
> + bdrv_invalidate_cache(bs, NULL);
> return exp;
> }
Please add a comment to explain why this call is necessary:
/* NBD exports are used for non-shared storage migration. Make sure
* that BDRV_O_INCOMING is cleared and the image is ready for write
* access since the export could be available before migration handover.
*/
If someone can come up with a 2- or 3-line comment that explains it
better, great.
The rest of the patch looks like it will work. I'm not thrilled about
putting BDRV_O_INCOMING logical inside bdrv_invalidate_cache() because
there was no coupling there before, but the code seems correct now.
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-10-06 10:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 8:52 [Qemu-devel] [RFC PATCH] block/migration: Disable cache invalidate for incoming migration Alexey Kardashevskiy
2014-10-02 9:45 ` Paolo Bonzini
2014-10-02 10:19 ` Alexey Kardashevskiy
2014-10-02 14:52 ` Stefan Hajnoczi
2014-10-03 4:12 ` Alexey Kardashevskiy
2014-10-06 10:03 ` Stefan Hajnoczi [this message]
2014-10-06 22:47 ` Alexey Kardashevskiy
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=20141006100336.GE2694@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=aik@ozlabs.ru \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).