Skip to content

Commit

Permalink
dpif: Clean up netdev_ports map on dpif_close().
Browse files Browse the repository at this point in the history
Commit 32b77c3("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 5119e25 ("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: 32b77c3("dpif: Save added ports in a port map.")
Signed-off-by: Joe Stringer <[email protected]>
Acked-by: Andy Zhou <[email protected]>
  • Loading branch information
joestringer committed Aug 9, 2017
1 parent e7164d9 commit 6595cb9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6595cb9

Please sign in to comment.