diff options
author | Joe Stringer <joe@ovn.org> | 2017-08-08 17:10:58 -0700 |
---|---|---|
committer | Joe Stringer <joe@ovn.org> | 2017-08-09 15:57:21 -0700 |
commit | 6595cb95a4a9734a61711cb227a6d86d00b0e649 (patch) | |
tree | 40abb127e27cbb3e7be3326a4ad012e7f76ee847 /lib | |
parent | e7164d96bcbcf79044a93f6e7acc68f05d8e3945 (diff) | |
download | openvswitch-6595cb95a4a9734a61711cb227a6d86d00b0e649.tar.gz |
dpif: Clean up netdev_ports map on dpif_close().
Commit 32b77c316d9982("dpif: Save added ports in a port map.")
introduced tracking of all dpif ports by taking a reference on each
available netdev when the dpif is opened, but it failed to clear out and
release references to these netdevs when the dpif is closed.
One of the problems introduced by this was that upon clean exit of
ovs-vswitchd via "ovs-appctl exit --cleanup", the "ovs-netdev" device
was not deleted. This which could cause problems in subsequent start up.
Commit 5119e258da92 ("dpif: Fix cleanup of userspace datapath.") fixed
this particular problem by not adding such devices to the netdev_ports
map, but the referencing/unreferencing upon dpif_open()/dpif_close() is
still not balanced.
Balance the referencing of netdevs by clearing these during dpif_close().
Fixes: 32b77c316d9982("dpif: Save added ports in a port map.")
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpif.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/dpif.c b/lib/dpif.c index e71f6a3d1..4c5eac60a 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -435,8 +435,16 @@ dpif_close(struct dpif *dpif) { if (dpif) { struct registered_dpif_class *rc; + struct dpif_port_dump port_dump; + struct dpif_port dpif_port; rc = shash_find_data(&dpif_classes, dpif->dpif_class->type); + + DPIF_PORT_FOR_EACH (&dpif_port, &port_dump, dpif) { + if (!dpif_is_internal_port(dpif_port.type)) { + netdev_ports_remove(dpif_port.port_no, dpif->dpif_class); + } + } dpif_uninit(dpif, true); dp_class_unref(rc); } |