From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE0dI-0001l7-EM for qemu-devel@nongnu.org; Thu, 13 Feb 2014 13:03:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WE0dC-0002VV-F1 for qemu-devel@nongnu.org; Thu, 13 Feb 2014 13:03:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE0dC-0002VE-6c for qemu-devel@nongnu.org; Thu, 13 Feb 2014 13:03:26 -0500 Message-ID: <52FD097E.2070707@redhat.com> Date: Thu, 13 Feb 2014 19:05:50 +0100 From: Max Reitz MIME-Version: 1.0 References: <20140212171621.GA4225@irqsave.net> In-Reply-To: <20140212171621.GA4225@irqsave.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Open by references and close on exit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?windows-1252?Q?Beno=EEt_Canet?= Cc: qemu-devel@nongnu.org Hi Beno=EEt, Hm, opening a reference should only result in the refcount of the=20 respective BDS being incremented through bdrv_ref(). Since no new BDS is=20 created, nothing should be added to bdrv_states. When the BDS =93closed=94= =20 through bdrv_unref(), it is only actually closed/deleted if the refcount=20 reaches zero. Until then, it remains in bdrv_states so it can be=20 referenced (since it has not been closed) and closed through=20 bdrv_close_all(). I don't really see how bdrv_close_all() closes the BDS =93a second time=94= =96=20 bdrv_unref() should only close the BDS if its refcount reaches zero. And=20 if that's the case, it should be removed from bdrv_states anyway. Kind regards, Max