Received: from eggs.gnu.org ([2001:4830:134:3::10]:49828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTXgz-0002ib-Up for qemu-devel@nongnu.org; Mon, 15 Sep 2014 10:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTXgu-0004wC-8G for qemu-devel@nongnu.org; Mon, 15 Sep 2014 10:55:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTXgt-0004w7-Vc for qemu-devel@nongnu.org; Mon, 15 Sep 2014 10:55:44 -0400 From: Markus Armbruster References: <1410620427-20089-1-git-send-email-armbru@redhat.com> <1410620427-20089-3-git-send-email-armbru@redhat.com> <20140915130216.GD22086@nodalink.com> <87mwa1c7me.fsf@blackfin.pond.sub.org> Date: Mon, 15 Sep 2014 16:55:36 +0200 In-Reply-To: <87mwa1c7me.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Mon, 15 Sep 2014 15:53:45 +0200") Message-ID: <87zje17x1z.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 02/23] block: New BlockBackend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Beno=C3=AEt?= Canet Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Markus Armbruster writes: > Beno=C3=AEt Canet writes: > >>> --- a/block.c >>> +++ b/block.c >>> @@ -2119,10 +2119,11 @@ static void bdrv_delete(BlockDriverState *bs) >>>=20=20 >>> bdrv_close(bs); >>>=20=20 >> >> >>> + drive_info_del(drive_get_by_blockdev(bs)); >>> + >>> /* remove from list, if necessary */ >>> bdrv_make_anon(bs); >>>=20=20 >>> - drive_info_del(drive_get_by_blockdev(bs)); >> >> Do we really want this move ? > > Yes, we do. If bdrv_make_anon() runs before drive_info_del(), this > conditional in drive_info_del() is always false: > > if (dinfo->bdrv->device_name[0]) { > blk_unref(blk_by_name(dinfo->bdrv->device_name)); > } > > I apologize for the hairiness. Things will become *way* simpler in > PATCH 4. It's not just temporarily hairy, it's temporarily wrong: double unref is possible. drive_del, the gift that keeps on giving... [...]