From patchwork Tue Oct 4 22:52:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 9362375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3925F60752 for ; Tue, 4 Oct 2016 22:53:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29E93289D5 for ; Tue, 4 Oct 2016 22:53:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E7F328C4C; Tue, 4 Oct 2016 22:53:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id CE24B289D5 for ; Tue, 4 Oct 2016 22:53:43 +0000 (UTC) Received: from localhost ([::1]:45557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brYak-0001ko-Pj for patchwork-qemu-devel@patchwork.kernel.org; Tue, 04 Oct 2016 18:53:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brYa1-0001Z7-Cb for qemu-devel@nongnu.org; Tue, 04 Oct 2016 18:52:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brYa0-0004JN-Je for qemu-devel@nongnu.org; Tue, 04 Oct 2016 18:52:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brYZy-0004He-JF; Tue, 04 Oct 2016 18:52:54 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 0BA6C793C3; Tue, 4 Oct 2016 22:52:54 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-58-151.rdu2.redhat.com [10.10.58.151]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u94MqlE1015115; Tue, 4 Oct 2016 18:52:53 -0400 From: John Snow To: qemu-block@nongnu.org Date: Tue, 4 Oct 2016 18:52:40 -0400 Message-Id: <1475621564-26623-7-git-send-email-jsnow@redhat.com> In-Reply-To: <1475621564-26623-1-git-send-email-jsnow@redhat.com> References: <1475621564-26623-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 04 Oct 2016 22:52:54 +0000 (UTC) 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 v9 06/10] block: Assert that bdrv_release_dirty_bitmap succeeded 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: John Snow , vsementsov@virtuozzo.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Fam Zheng We use a loop over bs->dirty_bitmaps to make sure the caller is only releasing a bitmap owned by bs. Let's also assert that in this case the caller is releasing a bitmap that does exist. Signed-off-by: Fam Zheng Reviewed-by: Max Reitz Signed-off-by: John Snow --- block/dirty-bitmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 860acc9..31d5296 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -305,6 +305,9 @@ static void bdrv_do_release_matching_dirty_bitmap(BlockDriverState *bs, } } } + if (bitmap) { + abort(); + } } void bdrv_release_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap)