qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] block: Invalidate all children


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 1/2] block: Invalidate all children
Date: Tue, 19 Apr 2016 20:23:15 +0800
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, 04/19 16:44, Changlong Xie wrote:
> On 04/19/2016 09:42 AM, Fam Zheng wrote:
> >Currently we only recurse to bs->file, which will miss the children in quorum
> >and VMDK.
> >
> >Recurse into the whole subtree to avoid that.
> >
> >Signed-off-by: Fam Zheng <address@hidden>
> >---
> >  block.c | 20 ++++++++++++++------
> >  1 file changed, 14 insertions(+), 6 deletions(-)
> >
> >diff --git a/block.c b/block.c
> >index d4939b4..fa8b38f 100644
> >--- a/block.c
> >+++ b/block.c
> >@@ -3201,6 +3201,7 @@ void bdrv_init_with_whitelist(void)
> >
> >  void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp)
> >  {
> >+    BdrvChild *child;
> >      Error *local_err = NULL;
> >      int ret;
> >
> >@@ -3215,13 +3216,20 @@ void bdrv_invalidate_cache(BlockDriverState *bs, 
> >Error **errp)
> >
> >      if (bs->drv->bdrv_invalidate_cache) {
> >          bs->drv->bdrv_invalidate_cache(bs, &local_err);
> 
> Kevin's commit 3456a8d1 introduced unexpected two spaces in this function,
> would you like remove it?

No, that's what to do in this patch. I'd just leave it.

> 
> -    if (bs->drv && bs->drv->bdrv_invalidate_cache) {
> +    if (!bs->drv)  {
> +        return;
> +    }
> 
> >-    } else if (bs->file) {
> >-        bdrv_invalidate_cache(bs->file->bs, &local_err);
> >+        if (local_err) {
> >+            bs->open_flags |= BDRV_O_INACTIVE;
> >+            error_propagate(errp, local_err);
> >+            return;
> >+        }
> >      }
> >-    if (local_err) {
> >-        bs->open_flags |= BDRV_O_INACTIVE;
> >-        error_propagate(errp, local_err);
> >-        return;
> >+
> >+    QLIST_FOREACH(child, &bs->children, next) {
> >+        bdrv_invalidate_cache(child->bs, &local_err);
> >+        if (local_err) {
> >+            bs->open_flags |= BDRV_O_INACTIVE;
> >+            error_propagate(errp, local_err);
> >+            return;
> 
> If we really need return here? I just mean for example, Quorum A has 3
> children(children.0, children.1, children.2), if we invalidate children.1
> failed, then we are not going to invalidate children.2

We report error anyway and the caller will abort the operation, it's not very
useful to continue.

Fam

> 
> >+        }
> >      }
> >
> >      ret = refresh_total_sectors(bs, bs->total_sectors);
> >
> 
> 
> 



reply via email to

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