qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH 3/4] net: del hub port when peer is deleted
Date: Fri, 06 Feb 2015 09:37:54 +0008



On Thu, Feb 5, 2015 at 10:25 PM, Stefan Hajnoczi <address@hidden> wrote:
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 <address@hidden>
 ---
  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.

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 == NET_CLIENT_OPTIONS_KIND_NIC) {

This way the hub port is consistently deleted when its peer is deleted.

Not sure, but if management always do netdev_del after device_del, it will get an error.

Thanks


Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]