From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJNNb-00060d-Sy for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:26:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJNNY-00005e-OF for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:26:03 -0500 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:50097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJNNY-00005W-Gk for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:26:00 -0500 Received: by mail-wi0-f180.google.com with SMTP id h11so10902021wiw.1 for ; Thu, 05 Feb 2015 06:25:59 -0800 (PST) Date: Thu, 5 Feb 2015 14:25:57 +0000 From: Stefan Hajnoczi Message-ID: <20150205142557.GH19277@stefanha-thinkpad.redhat.com> References: <1422860798-17495-1-git-send-email-jasowang@redhat.com> <1422860798-17495-3-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v2Uk6McLiE8OV1El" Content-Disposition: inline In-Reply-To: <1422860798-17495-3-git-send-email-jasowang@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: stefanha@redhat.com, aliguori@amazon.com, qemu-devel@nongnu.org --v2Uk6McLiE8OV1El Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 02, 2015 at 03:06:37PM +0800, Jason Wang wrote: > We should del hub port when peer is deleted since it will not be reused > and will only be freed during exit. >=20 > Signed-off-by: Jason Wang > --- > net/net.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/net/net.c b/net/net.c > index 7acc162..74e651e 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -996,6 +996,8 @@ void net_host_device_remove(Monitor *mon, const QDict= *qdict) > error_report("invalid host network device '%s'", device); > return; > } > + > + qemu_del_net_client(nc->peer); > qemu_del_net_client(nc); > } If qmp_netdev_del() is used the hub port will stay alive. Should the peer deletion happen in qemu_del_net_client(), similar to the existing NIC peer check? /* If there is a peer NIC, delete and cleanup client, but do not free. */ if (nc->peer && nc->peer->info->type =3D=3D NET_CLIENT_OPTIONS_KIND_NIC) { This way the hub port is consistently deleted when its peer is deleted. Stefan --v2Uk6McLiE8OV1El Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU0311AAoJEJykq7OBq3PIk9wH/iDxul/a8Ymxz+f3EZHmz1BT NB1sbWaKu51WipKLIUtmdrLjJCCnf/Ue/4N7qtozYDIXOcec0qUAro6yhz31kDxu mAVl0fmZDfhFC7W4Is+1Fr1b6A6drUHSWXaJ+zk7oWI23gsJsBLmBvS3NBcdsWdf PNRMmti/+GZ7LF94pfwh5S2hXLdwSRqT3RZYRB3LazKypVlbFYBzHUA95heipJE9 WtULiUz/Pbf4G7kT95LG8GElXNhS4r505c1o6qvnJIGdRadKZ2m2VY7Wxu0GQkuo U7HAI2Zhi3wRXsP8K0X0M4ahur9Ya/YKdpSruPiDGb9ijWFRbPEtx5ihHN8XkDY= =usPi -----END PGP SIGNATURE----- --v2Uk6McLiE8OV1El--