qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V4 4/5] block: Add backing file loop check in ch


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH V4 4/5] block: Add backing file loop check in change_backing_file()
Date: Mon, 22 Jul 2013 16:50:32 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

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 <address@hidden>
> ---
>  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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]