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 <jasow...@redhat.com> > --- > 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. 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 == NET_CLIENT_OPTIONS_KIND_NIC) { This way the hub port is consistently deleted when its peer is deleted. Stefan
pgpX7amAjiuNz.pgp
Description: PGP signature