qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 2/2] block: Inactivate all children


From: Kevin Wolf
Subject: Re: [Qemu-block] [PATCH 2/2] block: Inactivate all children
Date: Wed, 4 May 2016 12:12:42 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 19.04.2016 um 03:42 hat Fam Zheng geschrieben:
> Currently we only inactivate the top BDS. Actually bdrv_inactivate
> should be the opposite of bdrv_invalidate_cache.
> 
> Recurse into the whole subtree instead.
> 
> Signed-off-by: Fam Zheng <address@hidden>

Did you actually test this?

I would expect that bs->drv->bdrv_inactivate() fails now (as in
assertion failure) if it has anything to flush to the image because
bs->file has already be inactivated before. I think children need to be
inactived after their parents.

Nodes with multiple parents could actually become even more
interesting...

Kevin

>  block.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/block.c b/block.c
> index fa8b38f..9a84ed1 100644
> --- a/block.c
> +++ b/block.c
> @@ -3260,8 +3260,16 @@ void bdrv_invalidate_cache_all(Error **errp)
>  
>  static int bdrv_inactivate(BlockDriverState *bs)
>  {
> +    BdrvChild *child;
>      int ret;
>  
> +    QLIST_FOREACH(child, &bs->children, next) {
> +        ret = bdrv_inactivate(child->bs);
> +        if (ret < 0) {
> +            return ret;
> +        }
> +    }
> +
>      if (bs->drv->bdrv_inactivate) {
>          ret = bs->drv->bdrv_inactivate(bs);
>          if (ret < 0) {
> -- 
> 2.8.0
> 



reply via email to

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