]> git.proxmox.com Git - mirror_ovs.git/commitdiff
dpif-netlink: Don't destroy and recreate port if it exists
authorJianbo Liu <jianbol@mellanox.com>
Mon, 29 Oct 2018 08:29:41 +0000 (08:29 +0000)
committerBen Pfaff <blp@ovn.org>
Tue, 30 Oct 2018 18:28:36 +0000 (11:28 -0700)
In commit 7521e0cf9e ('ofproto-dpif: Let the dpif report when a port is
a duplicate'), the checking of port existence before adding was removed,
and it's up to the dpif to check if port exists and add only if needed.

But the port can't be added to datapath if already exists. Then it will
be destroyed and created again. This causes problem because configuration
may miss. For example, if creating two vxlan on the same port, its ingress
qdisc will be lost after recreated.

Fixes: 7521e0cf9e88 ("ofproto-dpif: Let the dpif report when a port is a duplicate.")
Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/dpif-netlink.c

index 2b2bb01a4fbdb7663dbcdccd6d5ab9f816623cc3..f2011f22e54890ad63b462a1d9f5ca6a89f328e6 100644 (file)
@@ -863,7 +863,7 @@ dpif_netlink_rtnl_port_create_and_add(struct dpif_netlink *dpif,
     name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
     error = dpif_netlink_port_add__(dpif, name, OVS_VPORT_TYPE_NETDEV, NULL,
                                     port_nop);
-    if (error) {
+    if (error && error != EEXIST) {
         dpif_netlink_rtnl_port_destroy(name, netdev_get_type(netdev));
     }
     return error;
@@ -880,7 +880,7 @@ dpif_netlink_port_add(struct dpif *dpif_, struct netdev *netdev,
     if (!ovs_tunnels_out_of_tree) {
         error = dpif_netlink_rtnl_port_create_and_add(dpif, netdev, port_nop);
     }
-    if (error) {
+    if (error && error != EEXIST) {
         error = dpif_netlink_port_add_compat(dpif, netdev, port_nop);
     }
     fat_rwlock_unlock(&dpif->upcall_lock);