From patchwork Wed Nov 4 18:57:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 540142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D94A61413DB for ; Thu, 5 Nov 2015 06:00:46 +1100 (AEDT) Received: from localhost ([::1]:56609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu3Ia-0000cG-JI for incoming@patchwork.ozlabs.org; Wed, 04 Nov 2015 14:00:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu3Gd-0005Oq-JN for qemu-devel@nongnu.org; Wed, 04 Nov 2015 13:58:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zu3Gc-0007Wh-Oq for qemu-devel@nongnu.org; Wed, 04 Nov 2015 13:58:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu3GY-0007Us-VO; Wed, 04 Nov 2015 13:58:39 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 942613674D8; Wed, 4 Nov 2015 18:58:38 +0000 (UTC) Received: from localhost (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA4IwYrR013387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 4 Nov 2015 13:58:37 -0500 From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 4 Nov 2015 19:57:40 +0100 Message-Id: <1446663467-22485-9-git-send-email-mreitz@redhat.com> In-Reply-To: <1446663467-22485-1-git-send-email-mreitz@redhat.com> References: <1446663467-22485-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Alberto Garcia , Markus Armbruster , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , Max Reitz Subject: [Qemu-devel] [PATCH v6 08/15] block: Use blk_remove_bs() in blk_delete() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Max Reitz --- block/block-backend.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 38580f7..5702cc1 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -165,10 +165,7 @@ static void blk_delete(BlockBackend *blk) assert(!blk->refcnt); assert(!blk->dev); if (blk->bs) { - assert(blk->bs->blk == blk); - blk->bs->blk = NULL; - bdrv_unref(blk->bs); - blk->bs = NULL; + blk_remove_bs(blk); } if (blk->root_state.throttle_state) { g_free(blk->root_state.throttle_group); @@ -347,6 +344,8 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk) */ void blk_remove_bs(BlockBackend *blk) { + assert(blk->bs->blk == blk); + notifier_list_notify(&blk->remove_bs_notifiers, blk); blk_update_root_state(blk);