From patchwork Tue Oct 7 11:59:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 397255 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 32B381400B0 for ; Tue, 7 Oct 2014 23:08:27 +1100 (EST) Received: from localhost ([::1]:58047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbTZ3-0002hU-7l for incoming@patchwork.ozlabs.org; Tue, 07 Oct 2014 08:08:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbTQl-0006KR-Jq for qemu-devel@nongnu.org; Tue, 07 Oct 2014 07:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbTQd-0002aC-KC for qemu-devel@nongnu.org; Tue, 07 Oct 2014 07:59:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbTQd-0002Zt-D9 for qemu-devel@nongnu.org; Tue, 07 Oct 2014 07:59:43 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s97Bxebx013677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Oct 2014 07:59:40 -0400 Received: from blackfin.pond.sub.org (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s97Bxaql001194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 7 Oct 2014 07:59:40 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 34C74304605E; Tue, 7 Oct 2014 13:59:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 7 Oct 2014 13:59:26 +0200 Message-Id: <1412683166-4934-25-git-send-email-armbru@redhat.com> In-Reply-To: <1412683166-4934-1-git-send-email-armbru@redhat.com> References: <1412683166-4934-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id s97Bxebx013677 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, benoit.canet@nodalink.com, stefanha@redhat.com, mreitz@redhat.com Subject: [Qemu-devel] [PATCH v6 24/24] block: Make device model's references to BlockBackend strong 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 Doesn't make a difference just yet, but it's the right thing to do. Signed-off-by: Markus Armbruster Reviewed-by: BenoƮt Canet Reviewed-by: Kevin Wolf Reviewed-by: Max Reitz --- block/block-backend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index bdcbac6..d0692b1 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -257,6 +257,7 @@ int blk_attach_dev(BlockBackend *blk, void *dev) if (blk->dev) { return -EBUSY; } + blk_ref(blk); blk->dev = dev; bdrv_iostatus_reset(blk->bs); @@ -290,6 +291,7 @@ void blk_detach_dev(BlockBackend *blk, void *dev) blk->dev_opaque = NULL; bdrv_set_guest_block_size(blk->bs, 512); qemu_coroutine_adjust_pool_size(-COROUTINE_POOL_RESERVATION); + blk_unref(blk); } /*