From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJjYT-0001WP-9v for qemu-devel@nongnu.org; Fri, 06 Feb 2015 09:06:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJjYN-00031C-97 for qemu-devel@nongnu.org; Fri, 06 Feb 2015 09:06:45 -0500 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:52179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJjYN-000317-1F for qemu-devel@nongnu.org; Fri, 06 Feb 2015 09:06:39 -0500 Received: by mail-we0-f173.google.com with SMTP id w55so2357137wes.4 for ; Fri, 06 Feb 2015 06:06:38 -0800 (PST) Date: Fri, 6 Feb 2015 14:06:34 +0000 From: Stefan Hajnoczi Message-ID: <20150206140634.GD18729@stefanha-thinkpad.redhat.com> References: <1422860798-17495-1-git-send-email-jasowang@redhat.com> <1422860798-17495-3-git-send-email-jasowang@redhat.com> <20150205142557.GH19277@stefanha-thinkpad.redhat.com> <1423214994.28488.0@smtp.corp.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="d9ADC0YsG2v16Js0" Content-Disposition: inline In-Reply-To: <1423214994.28488.0@smtp.corp.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: aliguori@amazon.com, stefanha@redhat.com, qemu-devel@nongnu.org --d9ADC0YsG2v16Js0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 06, 2015 at 09:37:54AM +0008, Jason Wang wrote: > On Thu, Feb 5, 2015 at 10:25 PM, Stefan Hajnoczi wro= te: > >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. > >> Signed-off-by: Jason Wang > >> --- > >> net/net.c | 2 ++ > >> 1 file changed, 2 insertions(+) > >> 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. >=20 > This is true if it has a peer. And the port will be freed during the > deletion of its peer. If no peer, it will be deleted soon. This is > consistent with the behaviors of other type of netdevs. > > > >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_NI= C) { > > > >This way the hub port is consistently deleted when its peer is deleted. >=20 > Not sure, but if management always do netdev_del after device_del, it will > get an error. Okay, I will merge this patch as-is. Stefan --d9ADC0YsG2v16Js0 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU1MpqAAoJEJykq7OBq3PI9ssH/AxakB6d1on56Ael7DNLAwpV WcOstXd2ok8MS26P09Cgmm516+0c7Vw/B8mp1NYI4/9sC36wW9U1uWXLakXG+pCl NuDTd9wWJK2Xe+wSDmwxyts+pf/n/+LJu0nnyb8y0FkTqmkzrzXFNhMeYaoknxy1 Zz3djVaQB5z9m8MpAfISFuFjaaHTS1K0mATvBZP2G6HJuP/5jr0aadKvJvlEzJGg QfTtFaRZQ2hNr+tLL42LNEbtje2AZusXqiTi/sQR8ETwjXk2GwbBTdIXUB/mfHzw Xs99RVu9d8xvbUPX/aGa6WKPGY8vb6HCIWnfZVzSPuqZU/HAqUIjO6PMhAA6AlA= =mryb -----END PGP SIGNATURE----- --d9ADC0YsG2v16Js0--