From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNEP4-0001Ss-GY for qemu-devel@nongnu.org; Tue, 11 Mar 2014 00:34:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNEP0-0007AH-2o for qemu-devel@nongnu.org; Tue, 11 Mar 2014 00:34:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNEOz-0007A8-RA for qemu-devel@nongnu.org; Tue, 11 Mar 2014 00:34:54 -0400 Message-ID: <531E9268.7000709@redhat.com> Date: Mon, 10 Mar 2014 22:34:48 -0600 From: Eric Blake MIME-Version: 1.0 References: <1394436721-21812-1-git-send-email-cyliu@suse.com> <1394436721-21812-8-git-send-email-cyliu@suse.com> In-Reply-To: <1394436721-21812-8-git-send-email-cyliu@suse.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1AIuNIPgnR5GSsNFdnTngwCMGIDK3TvGp" Subject: Re: [Qemu-devel] [PATCH v22 07/25] change block layer to support both QemuOpts and QEMUOptionParamter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu , qemu-devel@nongnu.org Cc: kwolf@redhat.com, Dong Xu Wang , stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1AIuNIPgnR5GSsNFdnTngwCMGIDK3TvGp Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/10/2014 01:31 AM, Chunyan Liu wrote: > Change block layer to support both QemuOpts and QEMUOptionParameter. > After this patch, it will change backend drivers one by one. At the end= , > QEMUOptionParameter will be removed and only QemuOpts is kept. >=20 > Signed-off-by: Dong Xu Wang > Signed-off-by: Chunyan Liu > --- > @@ -420,7 +421,11 @@ static void coroutine_fn bdrv_create_co_entry(void= *opaque) > CreateCo *cco =3D opaque; > assert(cco->drv); > =20 > - ret =3D cco->drv->bdrv_create(cco->filename, cco->options, &local_= err); > + if (cco->drv->bdrv_create2) { > + ret =3D cco->drv->bdrv_create2(cco->filename, cco->opts, &loca= l_err); Is it worth assert(!cco->options) here, > + } else { > + ret =3D cco->drv->bdrv_create(cco->filename, cco->options, &lo= cal_err); and assert(!cco->opts) here, to ensure that we aren't ignoring options from the other style of create? Then again, it gets cleaned up in later patches. > @@ -5248,28 +5266,31 @@ void bdrv_img_create(const char *filename, cons= t char *fmt, > return; > } > =20 > - create_options =3D append_option_parameters(create_options, > - drv->create_options); > - create_options =3D append_option_parameters(create_options, > - proto_drv->create_option= s); > + if (drv->bdrv_create2) { > + create_opts =3D qemu_opts_append(create_opts, drv->create_opts= ); > + create_opts =3D qemu_opts_append(create_opts, proto_drv->creat= e_opts); Memory leak. As implemented earlier in the series, qemu_opts_append() creates a new object, but as you are overwriting create_opts with the second result without hanging onto the pointer returned by the first call, you have just leaked the first instance. I ran out of time to review further today, but this series still needs more work, and I am starting to doubt that it will make 2.0. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --1AIuNIPgnR5GSsNFdnTngwCMGIDK3TvGp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTHpJoAAoJEKeha0olJ0NqLtoH/0TKON24WGVDKBTO5M5kI+1B HJo2Ei21Ifk3IpyygBTNJEYtpfsL+V0Ks/S+4YCoU9r2rCr66SVOcL4FsWcV4qtB GvOvDrg1lGzevADpvG1s+GNvBgBUPCzKQH/GTyrMwjs73EOcJOlspr/LJgnVZXdQ AksznRwENXAg/Sz5b4dQSZgKCm6EDH3Fv6gDt5SPRVwkVowv+fWbixw+8r6tikp7 fbbkBM+w5cx+mM6CN6h4KcgFbvBdPvYRiPXENlT3ktCbf0wxgneSVpQcTECGO2eH tA9bKvUc3ya3qYm4TiMAvTsIZQBUcLaF1v5ZIPR8Mi6se+2yUCQWMt5szlRs2a4= =meEL -----END PGP SIGNATURE----- --1AIuNIPgnR5GSsNFdnTngwCMGIDK3TvGp--