From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar5Pe-0001bu-Nu for qemu-devel@nongnu.org; Fri, 15 Apr 2016 11:12:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ar5Pd-0004mh-RM for qemu-devel@nongnu.org; Fri, 15 Apr 2016 11:12:02 -0400 Date: Fri, 15 Apr 2016 17:11:54 +0200 From: Kevin Wolf Message-ID: <20160415151154.GG4341@noname.redhat.com> References: <1460689866-31020-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1460689866-31020-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: Inactivate all nodes at migration source List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, Max Reitz , qemu-block@nongnu.org Am 15.04.2016 um 05:11 hat Fam Zheng geschrieben: > qcow2 is not necessarily the top layer node. Since bdrv_inactivate() > doesn't recurse, we should ensure all block nodes are inactivated. > > Signed-off-by: Fam Zheng Hm, I don't think that's quite right. bdrv_inactivate_all() should be the opposite of bdrv_invalidate_cache_all(), i.e. both operations should affect the same nodes. Currently, both use bdrv_next(), but bdrv_invalidate_cache() is partially recursive: It is called for bs->file (by block.c if there is no implementation for bs, by the driver implementation otherwise), or for all children in the quorum case, but not for other children like bs->backing or the extents for VMDK. If you think that that sounds wrong, I'm with you. :-) The question is how to fix it. I think I'd make bdrv_invalidate() recurse to all children and then do the same for bdrv_inactivate(). Kevin > block.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block.c b/block.c > index d4939b4..1c575e4 100644 > --- a/block.c > +++ b/block.c > @@ -3270,7 +3270,7 @@ int bdrv_inactivate_all(void) > BlockDriverState *bs = NULL; > int ret; > > - while ((bs = bdrv_next(bs)) != NULL) { > + while ((bs = bdrv_next_node(bs)) != NULL) { > AioContext *aio_context = bdrv_get_aio_context(bs); > > aio_context_acquire(aio_context); > -- > 2.8.0 >