[ovs-dev] [fd leak 1/4] dpif-linux: Close channel Netlink sockets when a port number gets recycled.

Ben Pfaff blp at nicira.com
Thu May 2 00:15:55 UTC 2013


When ovs-vswitchd deletes a port with dpif_linux_port_del(), that function
uses del_channel() to delete the corresponding channel, including closing
its Netlink socket fd.  However, if the vport gets removed by some other
process (e.g. "ip link delete" for veths) then this function never gets
called and thus the channel never gets deleted.

This commit is a partial fix for the problem by ensuring that if a port
number gets reused, the old Netlink socket assigned to that port is closed
before the new one is installed.

Bug #16784.
Reported-by: Paul Ingram <paul at nicira.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/dpif-linux.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 39acc9a..933aabe 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -337,6 +337,7 @@ add_channel(struct dpif_linux *dpif, uint32_t port_no, struct nl_sock *sock)
         return errno;
     }
 
+    nl_sock_destroy(dpif->channels[port_no].sock);
     dpif->channels[port_no].sock = sock;
     dpif->channels[port_no].last_poll = LLONG_MIN;
 
-- 
1.7.2.5




More information about the dev mailing list