From patchwork Tue Apr 19 01:42:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 8876211 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AAEF8BF29F for ; Tue, 19 Apr 2016 01:43:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27D03201E4 for ; Tue, 19 Apr 2016 01:43:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 858DD20145 for ; Tue, 19 Apr 2016 01:43:15 +0000 (UTC) Received: from localhost ([::1]:48519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asKh7-0000k6-M7 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Apr 2016 21:43:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asKgt-0000YD-Uh for qemu-devel@nongnu.org; Mon, 18 Apr 2016 21:43:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asKgt-0004o4-5Z for qemu-devel@nongnu.org; Mon, 18 Apr 2016 21:42:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asKgr-0004lA-Er; Mon, 18 Apr 2016 21:42:57 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A45A85365; Tue, 19 Apr 2016 01:42:57 +0000 (UTC) Received: from lemon.redhat.com (vpn1-4-251.pek2.redhat.com [10.72.4.251]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3J1gmHo023210; Mon, 18 Apr 2016 21:42:54 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 19 Apr 2016 09:42:57 +0800 Message-Id: <1461030177-29144-3-git-send-email-famz@redhat.com> In-Reply-To: <1461030177-29144-1-git-send-email-famz@redhat.com> References: <1461030177-29144-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/2] block: Inactivate all children X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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) {