From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: Markus Armbruster <armbru@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"eblake@redhat.com" <eblake@redhat.com>,
Kevin Wolf <kwolf@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 1/6] block/dirty-bitmaps: add user_locked status checker
Date: Wed, 3 Oct 2018 14:28:05 -0400 [thread overview]
Message-ID: <435f5820-c7fd-e1b0-b1d5-26e2a5de9c61@redhat.com> (raw)
In-Reply-To: <f803d9c8-90e0-56c7-320d-0c19d8b5b284@virtuozzo.com>
On 10/03/2018 08:47 AM, Vladimir Sementsov-Ogievskiy wrote:
> 03.10.2018 02:02, John Snow wrote:
>> Instead of both frozen and qmp_locked checks, wrap it into one check.
>> frozen implies the bitmap is split in two (for backup), and shouldn't
>> be modified. qmp_locked implies it's being used by another operation,
>> like being exported over NBD. In both cases it means we shouldn't allow
>> the user to modify it in any meaningful way.
>>
>> Replace any usages where we check both frozen and qmp_locked with the
>> new check.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>> block/dirty-bitmap.c | 6 ++++++
>> blockdev.c | 29 ++++++++---------------------
>> include/block/dirty-bitmap.h | 1 +
>> migration/block-dirty-bitmap.c | 10 ++--------
>> 4 files changed, 17 insertions(+), 29 deletions(-)
>>
>> diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
>> index 8ac933cf1c..85bc668f6a 100644
>> --- a/block/dirty-bitmap.c
>> +++ b/block/dirty-bitmap.c
>> @@ -176,6 +176,12 @@ bool bdrv_dirty_bitmap_frozen(BdrvDirtyBitmap *bitmap)
>> return bitmap->successor;
>> }
>>
>> +/* Both conditions disallow user-modification via QMP. */
>> +bool bdrv_dirty_bitmap_user_locked(BdrvDirtyBitmap *bitmap) {
>> + return (bdrv_dirty_bitmap_frozen(bitmap) ||
>> + bdrv_dirty_bitmap_qmp_locked(bitmap));
>
> hmm, extra parentheses
I'm fond of them, but I'll take them out.
>
>> +}
>> +
>> void bdrv_dirty_bitmap_set_qmp_locked(BdrvDirtyBitmap *bitmap, bool qmp_locked)
>> {
>> qemu_mutex_lock(bitmap->mutex);
>
> [...]
>
>> --- a/migration/block-dirty-bitmap.c
>> +++ b/migration/block-dirty-bitmap.c
>> @@ -301,14 +301,8 @@ static int init_dirty_bitmap_migration(void)
>> goto fail;
>> }
>>
>> - if (bdrv_dirty_bitmap_frozen(bitmap)) {
>> - error_report("Can't migrate frozen dirty bitmap: '%s",
>> - bdrv_dirty_bitmap_name(bitmap));
>> - goto fail;
>> - }
>> -
>> - if (bdrv_dirty_bitmap_qmp_locked(bitmap)) {
>> - error_report("Can't migrate locked dirty bitmap: '%s",
>> + if (bdrv_dirty_bitmap_user_locked(bitmap)) {
>> + error_report("Can't migrate a bitmap that is in use: '%s'",
>
> "by another operation" like in other cases?
>
Oh, sure. Can't hurt.
>> bdrv_dirty_bitmap_name(bitmap));
>> goto fail;
>> }
>
> anyway,
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> --
> Best regards,
> Vladimir
>
Thanks, I'll just make these edits and trust that Eric is fine with it
as well.
--js
next prev parent reply other threads:[~2018-10-03 18:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 23:02 [Qemu-devel] [PATCH v4 0/6] dirty-bitmaps: fix QMP command permissions John Snow
2018-10-02 23:02 ` [Qemu-devel] [PATCH v4 1/6] block/dirty-bitmaps: add user_locked status checker John Snow
2018-10-03 12:19 ` Eric Blake
2018-10-03 12:47 ` Vladimir Sementsov-Ogievskiy
2018-10-03 18:28 ` John Snow [this message]
2018-10-03 18:39 ` Eric Blake
2018-10-02 23:02 ` [Qemu-devel] [PATCH v4 2/6] block/dirty-bitmaps: fix merge permissions John Snow
2018-10-03 12:20 ` Eric Blake
2018-10-03 13:01 ` Vladimir Sementsov-Ogievskiy
2018-10-02 23:02 ` [Qemu-devel] [PATCH v4 3/6] block/dirty-bitmaps: allow clear on disabled bitmaps John Snow
2018-10-03 12:21 ` Eric Blake
2018-10-03 13:02 ` Vladimir Sementsov-Ogievskiy
2018-10-02 23:02 ` [Qemu-devel] [PATCH v4 4/6] block/dirty-bitmaps: prohibit enable/disable on locked/frozen bitmaps John Snow
2018-10-03 12:23 ` Eric Blake
2018-10-03 13:05 ` Vladimir Sementsov-Ogievskiy
2018-10-02 23:02 ` [Qemu-devel] [PATCH v4 5/6] block/backup: prohibit backup from using in use bitmaps John Snow
2018-10-03 12:28 ` Eric Blake
2018-10-03 13:21 ` Vladimir Sementsov-Ogievskiy
2018-10-03 16:43 ` John Snow
2018-10-03 14:04 ` Vladimir Sementsov-Ogievskiy
2018-10-02 23:02 ` [Qemu-devel] [PATCH v4 6/6] nbd: forbid use of frozen bitmaps John Snow
2018-10-03 12:31 ` Eric Blake
2018-10-03 14:06 ` Vladimir Sementsov-Ogievskiy
2018-10-02 23:08 ` [Qemu-devel] [PATCH v4 0/6] dirty-bitmaps: fix QMP command permissions John Snow
2018-10-17 20:29 ` Eric Blake
2018-10-03 20:28 ` John Snow
2018-10-17 18:24 ` Eric Blake
2018-10-17 18:28 ` John Snow
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=435f5820-c7fd-e1b0-b1d5-26e2a5de9c61@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--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).