On Tue, 11/05 22:09, Xu Wang wrote: > Backing file loop should be checked before qemu-img create command > execution. If loop is found, qemu-img create should be stopped and > an error printed. > > Signed-off-by: Xu Wang <gesa...@linux.vnet.ibm.com> > --- > block.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/block.c b/block.c > index 3443117..8423e80 100644 > --- a/block.c > +++ b/block.c > @@ -4670,15 +4670,15 @@ void bdrv_img_create(const char *filename, const char > *fmt, > } > > backing_file = get_option_parameter(param, BLOCK_OPT_BACKING_FILE); > + backing_fmt = get_option_parameter(param, BLOCK_OPT_BACKING_FMT); > if (backing_file && backing_file->value.s) { > - if (!strcmp(filename, backing_file->value.s)) { > - error_setg(errp, "Error: Trying to create an image with the " > - "same filename as the backing file"); > + if (!bdrv_new_chain_okay(filename, backing_file->value.s, > + backing_fmt->value.s)) { > + error_report("bdrv_img_create: loop exists, image create > failed");
Please use error_setg(errp, "..."); Fam