Received: from eggs.gnu.org ([2001:4830:134:3::10]:52828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3fD-0004PA-5K for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:30:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ai3f9-0001rQ-Qv for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:30:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3f9-0001rJ-MC for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:30:43 -0400 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 5B853C049D5A for ; Mon, 21 Mar 2016 17:30:43 +0000 (UTC) From: Markus Armbruster References: <1456151945-11225-1-git-send-email-pbonzini@redhat.com> <1456151945-11225-4-git-send-email-pbonzini@redhat.com> <87k2kvzu0z.fsf@blackfin.pond.sub.org> <56F01F8A.2090902@redhat.com> Date: Mon, 21 Mar 2016 18:30:41 +0100 In-Reply-To: <56F01F8A.2090902@redhat.com> (Paolo Bonzini's message of "Mon, 21 Mar 2016 17:21:30 +0100") Message-ID: <87shzj68n2.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 3/3] block: remove legacy_dinfo at blk_detach_dev time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Paolo Bonzini writes: > On 21/03/2016 17:15, Markus Armbruster wrote: >> * Explicitly with x-blockdev-del >> >> Fails unless no other reference exists. Where is the legacy_dinfo >> released? > > Can a -drive block device be deleted with x-blockdev-del even?!? When I wrote my review, I forgot that I expect x-blockdev-del to accept only backends created with blockdev-add. With that, my question is indeed moot. However, I've now tested my expectation, and it turned out to be wrong. I'm inclined to call that a bug. > In other words, you said "This looks like DriveInfo now owns a reference > to BlockBackend, even though the pointer still goes in the other > direction". I say, "I thought this was the idea all along"... For me, the DriveInfo doesn't own anything, but a BlockBackend may have a DriveInfo. Evidence: * The pointer goes from the BlockBackend to the DriveInfo * To go back, you search the blk_backends for the one that has the DriveInfo. See blk_by_legacy_dinfo(). * There is no list of DriveInfo. If you want to find one, you search blk_backends. See drive_get() & friends. > Shall I add a check to x-blockdev-del that gives an error if the > BlockBackend has a DriveInfo attached? Yes, please. But do double-check with Kevin & Max, who might have different ideas on blockdev-add/del than I do. > > Paolo > >> * Implicitly via warty automatic deletion >> >> Your PATCH 01 has the necessary replacement of blk_unref(blk) by >> blkdev_del_drive(blk) for some devices (virtio-blk.c, scsi-bus.c, >> xen_disk,c, piix.c), butas far as I can see not for others such as >> nvme.c.