On 11/28/2017 02:14 AM, Vladimir Sementsov-Ogievskiy wrote: > 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 <vsement...@virtuozzo.com> > --- > block/qcow2.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/block/qcow2.c b/block/qcow2.c > index 1914a940e5..f5f205e1b7 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -1450,7 +1450,13 @@ static int qcow2_do_open(BlockDriverState *bs, QDict > *options, int flags, > s->autoclear_features &= QCOW2_AUTOCLEAR_MASK; > } > > - if (qcow2_load_autoloading_dirty_bitmaps(bs, &local_err)) { > + if (bdrv_has_readonly_bitmaps(bs)) { > + if (!bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) & > BDRV_O_INACTIVE)) { > + bool header_updated = false; > + qcow2_reopen_bitmaps_rw_hint(bs, &header_updated, &local_err); > + update_header = update_header && !header_updated; > + } > + } else if (qcow2_load_autoloading_dirty_bitmaps(bs, &local_err)) { > update_header = false; > } > if (local_err != NULL) { >
It sounds right to me, but I'm going to ask for eyes from Kevin or Max. Acked-by: John Snow <js...@redhat.com>