From: Eric Blake <eblake@redhat.com>
To: "Denis V. Lunev" <den@openvz.org>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] block: assert no image modification under BDRV_O_INACTIVE
Date: Wed, 5 Apr 2017 10:37:09 -0500 [thread overview]
Message-ID: <9b9dc574-b6bb-e0ef-adf0-84d35bf4a883@redhat.com> (raw)
In-Reply-To: <1491405505-31620-3-git-send-email-den@openvz.org>
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]
On 04/05/2017 10:18 AM, Denis V. Lunev wrote:
> As long as BDRV_O_INACTIVE is set, the image file is only opened so we
> have a file descriptor for it. We're definitely not supposed to modify
> the image, it's still owned by the migration source.
>
> This commit is an addition to 09e0c771 but the assert() is added to
> bdrv_truncate().
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Max Reitz <mreitz@redhat.com>
> ---
> block.c | 2 ++
> 1 file changed, 2 insertions(+)
I don't feel comfortable adding an assert this late in the 2.9 phase,
but think it makes perfect sense as a 2.10 addition.
Reviewed-by: Eric Blake <eblake@redhat.com>
>
> diff --git a/block.c b/block.c
> index 927ba89..9273741 100644
> --- a/block.c
> +++ b/block.c
> @@ -3279,6 +3279,8 @@ int bdrv_truncate(BdrvChild *child, int64_t offset)
> if (bs->read_only)
> return -EACCES;
>
> + assert(!(bs->open_flags & BDRV_O_INACTIVE));
> +
> ret = drv->bdrv_truncate(bs, offset);
> if (ret == 0) {
> ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-04-05 15:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 15:18 [Qemu-devel] [PATCH for 2.10 0/2] block: simple changes Denis V. Lunev
2017-04-05 15:18 ` [Qemu-devel] [PATCH 1/2] block: fix obvious coding style mitakes in block_int.h Denis V. Lunev
2017-04-05 15:35 ` Eric Blake
2017-04-13 19:01 ` Max Reitz
2017-04-05 15:18 ` [Qemu-devel] [PATCH 2/2] block: assert no image modification under BDRV_O_INACTIVE Denis V. Lunev
2017-04-05 15:37 ` Eric Blake [this message]
2017-04-05 15:47 ` Denis V. Lunev
2017-04-13 19:09 ` Max Reitz
2017-04-13 19:11 ` [Qemu-devel] [PATCH for 2.10 0/2] block: simple changes Max Reitz
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=9b9dc574-b6bb-e0ef-adf0-84d35bf4a883@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--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).