On 12.10.20 19:43, Andrey Shinkevich wrote: > Avoid writing a filter JSON-name to QCOW2 image when the backing file > is changed after the block stream job. > > Signed-off-by: Andrey Shinkevich <[email protected]> > --- > block/stream.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/block/stream.c b/block/stream.c > index e0540ee..51462bd 100644 > --- a/block/stream.c > +++ b/block/stream.c > @@ -65,6 +65,7 @@ static int stream_prepare(Job *job) > BlockDriverState *bs = blk_bs(bjob->blk); > BlockDriverState *unfiltered_bs = bdrv_skip_filters(bs); > BlockDriverState *base = bdrv_filter_or_cow_bs(s->above_base); > + BlockDriverState *base_unfiltered = bdrv_skip_filters(base); > Error *local_err = NULL; > int ret = 0; > > @@ -73,10 +74,10 @@ static int stream_prepare(Job *job) > > if (bdrv_cow_child(unfiltered_bs)) { > const char *base_id = NULL, *base_fmt = NULL; > - if (base) { > - base_id = s->backing_file_str; > - if (base->drv) { > - base_fmt = base->drv->format_name; > + if (base_unfiltered) { > + base_id = base_unfiltered->filename;
I think you have to leave this querying s->backing_file_str, and instead
change how qmp_block_stream() gets @base_name. block-stream has a
backing-file parameter that can override the string that should be used
here.
(Or perhaps you can let qmp_block_stream() just set it to NULL if no
backing-file parameter is passed and then fall back to
base_unfiltered->filename only here. Probably better, actually, in case
base_unfiltered is changed during the job run.)
Max
> + if (base_unfiltered->drv) {
> + base_fmt = base_unfiltered->drv->format_name;
> }
> }
> bdrv_set_backing_hd(unfiltered_bs, base, &local_err);
>
signature.asc
Description: OpenPGP digital signature
