All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/qcow2: fix logic around dirty_bitmaps_loaded
Date: Tue, 12 Jun 2018 18:18:23 -0400	[thread overview]
Message-ID: <bf81ec94-7e29-d902-9f8d-34c7a5b50557@redhat.com> (raw)
In-Reply-To: <bba5e735-2c16-e6a6-7742-7bc2ddcd0380@redhat.com>



On 06/12/2018 06:11 PM, John Snow wrote:
> 
> 
> On 06/12/2018 01:26 PM, Vladimir Sementsov-Ogievskiy wrote:
>> First: this variable was introduced to handle reopens. We need it on
>> following qcow2_do_open, to don't try loading bitmaps again. So, we are
>> fixing qcow2_invalidate_cache().
>>
>> However, if we fix only qcow2_invalidate_cache, iotest 169 fails on
>> case test__persistent__not_migbitmap__online_shared, because on first
>> target open, source is not yet closed, and is not yet stored bitmaps,
>> so, we are load nothing. And on second open, dirty_bitmaps_loaded is
>> already true, but we have no bitmaps to reopen with
>> qcow2_reopen_bitmaps_rw_hint(). So, we are fixing qcow2_do_open() too.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>  block/qcow2.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/qcow2.c b/block/qcow2.c
>> index 6fa5e1d71a..b4216a5830 100644
>> --- a/block/qcow2.c
>> +++ b/block/qcow2.c
>> @@ -1499,7 +1499,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
>>          {
>>              qcow2_reopen_bitmaps_rw_hint(bs, &header_updated, &local_err);
>>          }
>> -    } else {
>> +    } else if (s->nb_bitmaps > 0) {
>>          header_updated = qcow2_load_dirty_bitmaps(bs, &local_err);
>>          s->dirty_bitmaps_loaded = true;
>>      }
>> @@ -2178,6 +2178,7 @@ static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs,
>>      QDict *options;
>>      Error *local_err = NULL;
>>      int ret;
>> +    bool dirty_bitmaps_loaded = s->dirty_bitmaps_loaded;
>>  
>>      /*
>>       * Backing files are read-only which makes all of their metadata immutable,
>> @@ -2190,6 +2191,7 @@ static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs,
>>      qcow2_close(bs);
>>  
>>      memset(s, 0, sizeof(BDRVQcow2State));
>> +    s->dirty_bitmaps_loaded = dirty_bitmaps_loaded;
>>      options = qdict_clone_shallow(bs->options);
>>  
>>      flags &= ~BDRV_O_INACTIVE;
>>
> 
> Ah, tch... I didn't realize that invalidate completely wipes the qcow2
> metadata.
> 
> I guess the other three fields, nb_bitmaps, bitmap_directory_size and
> bitmap_directory_offset get initialized again on re-open.
> 
> (I suppose this means I need to rethink caching bm_list more carefully,
> too...)
> 
> I think this looks correct mechanically.
> 

Oh, I meant:

Reviewed-by: John Snow <jsnow@redhat.com>

  reply	other threads:[~2018-06-12 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 17:26 [Qemu-devel] [PATCH] block/qcow2: fix logic around dirty_bitmaps_loaded Vladimir Sementsov-Ogievskiy
2018-06-12 22:11 ` [Qemu-devel] [Qemu-block] " John Snow
2018-06-12 22:18   ` John Snow [this message]
2018-06-20 17:17     ` Vladimir Sementsov-Ogievskiy
2018-06-20 17:20       ` Vladimir Sementsov-Ogievskiy
2018-06-21 18:26 ` [Qemu-devel] drop " 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=bf81ec94-7e29-d902-9f8d-34c7a5b50557@redhat.com \
    --to=jsnow@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.