On Mon, 07/22 04:05, Xu Wang wrote: > Backing file loop should be checked before calling change_backing_ > file(). If loop appeared, this calling should be stopped and an > error was printed. > > Signed-off-by: Xu Wang <cngesa...@gmail.com> > --- > block.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/block.c b/block.c > index 9daf63c..d996524 100644 > --- a/block.c > +++ b/block.c > @@ -1967,6 +1967,13 @@ int bdrv_change_backing_file(BlockDriverState *bs, > return -EINVAL; > } > > + /* Check if loop exists in backing files chain after changed */ > + if (bdrv_backing_file_loop_check(bs->filename, > + bs->drv ? bs->drv->format_name : NULL, > + backing_file, backing_fmt)) {
I'm wondering if it will be helpful to add a concrete error message here, e.g. for qemu-img rebase, so it will be easier for user to know it fails because of backing loop. > + return -EIO; > + } > + > if (drv->bdrv_change_backing_file != NULL) { > ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt); > } else { > -- > 1.8.1.4 > -- Fam