Received: from eggs.gnu.org ([2001:4830:134:3::10]:46998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKRY1-0003M8-Th for qemu-devel@nongnu.org; Tue, 05 Jul 2016 10:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKRXz-0006cD-Fs for qemu-devel@nongnu.org; Tue, 05 Jul 2016 10:42:00 -0400 References: <1467296007-12252-1-git-send-email-kwolf@redhat.com> <1467296007-12252-2-git-send-email-kwolf@redhat.com> <429dc8d6-bff3-6918-71cc-c03efbe6c604@redhat.com> <20160704104354.GC5399@noname.redhat.com> From: Max Reitz Message-ID: Date: Tue, 5 Jul 2016 16:41:51 +0200 MIME-Version: 1.0 In-Reply-To: <20160704104354.GC5399@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JL3Mc9VHK2h09vwSti7FGpQbhTfPWGugd" Subject: Re: [Qemu-devel] [PATCH v2 1/6] block/qdev: Allow node name for drive properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-block@nongnu.org, eblake@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JL3Mc9VHK2h09vwSti7FGpQbhTfPWGugd From: Max Reitz To: Kevin Wolf Cc: qemu-block@nongnu.org, eblake@redhat.com, qemu-devel@nongnu.org Message-ID: Subject: Re: [PATCH v2 1/6] block/qdev: Allow node name for drive properties References: <1467296007-12252-1-git-send-email-kwolf@redhat.com> <1467296007-12252-2-git-send-email-kwolf@redhat.com> <429dc8d6-bff3-6918-71cc-c03efbe6c604@redhat.com> <20160704104354.GC5399@noname.redhat.com> In-Reply-To: <20160704104354.GC5399@noname.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 04.07.2016 12:43, Kevin Wolf wrote: > Am 02.07.2016 um 17:33 hat Max Reitz geschrieben: >> On 30.06.2016 16:13, Kevin Wolf wrote: >>> If a node name instead of a BlockBackend name is specified as the dri= ver >>> for a guest device, an anonymous BlockBackend is created now. >>> >>> Signed-off-by: Kevin Wolf >>> --- >>> hw/core/qdev-properties-system.c | 22 +++++++++++++++++++--- >>> 1 file changed, 19 insertions(+), 3 deletions(-) >> >> I just noticed this won't work with (at least) USB mass storage device= s. >> scsi_bus_legacy_add_drive() creates a new device and uses >> qdev_prop_set_drive() to set its drive, and that function uses >> blk_name() to get the required value for .drive. >> >> That can of course be fixed by using bdrv_get_node_name(blk_bs(value))= >> there if blk_name(value) is empty. But in addition we need to make sur= e >> that the BB is not deleted in usb_msd_realize_storage() (because that >> function has to detach the device from the BB before creating the SCSI= >> disk), so we need to wrap the explicitly hacky block there in >> blk_ref(blk) and blk_unref(blk). >=20 > I'm not sure if I even want to fix this here... Maybe it's better to > leave node names broken for usb-storage, as a motivation for someone to= > try and clean up this mess for good. I mean, it's not the first time > that this hack breaks. Well, you'll at least have to add the blk_ref()+blk_unref() wrapping, or we'll get accesses to freed memory. Realistically speaking, I doubt deliberately making USB mass storage devices not support the new drive syntax would actually motivate someone to clean the whole thing up. In my opinion, just making qdev_prop_set_drive() support anonymous BBs is simple enough, so it'd be worth it. I don't think we gain anything by not doing it. Max --JL3Mc9VHK2h09vwSti7FGpQbhTfPWGugd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEvBAEBCAAZBQJXe8cvEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrXMB B/41JmicCC7chqhOM38jerIlOdexQ5aCY03CS+KnEK1NsEY99Wx7JznswiUW1XFp XVQ0+8gPeE/VSHR3J6/kqC2fBE27hn2yta6MYerIqSJRFBJdWidhwtVnJfwCUwz7 xd05MOvJLJD6fUHDu0gj4mvSZITCrEgVstSEh9BaxRcTvTbmxdNAIEIpEDSnmqDb 3SRhZ57DxWdo+PZgtSpbC3K0rHc4O97VOhOQ13GEeWpvm+g/9r5qdKIncT06nNBX hpWG3p5zCIAeW/zfk9huzqRAhWA1UsfhsMHPONGO55BLFv3HqeJPuV9dLY/nXKcy zM+Z/e9o0/i7jYFM3mBS8Ago =aRna -----END PGP SIGNATURE----- --JL3Mc9VHK2h09vwSti7FGpQbhTfPWGugd--