From: Pravin B Shelar Date: Tue, 8 Dec 2015 02:23:18 +0000 (-0800) Subject: datapath: Backport: openvswitch: fix hangup on vxlan/gre/geneve device deletion X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=1e41fa16f0e4342473a3642286b8aa7d887d3dde datapath: Backport: openvswitch: fix hangup on vxlan/gre/geneve device deletion Upstream commit: Each openvswitch tunnel vport (vxlan,gre,geneve) holds a reference to the underlying tunnel device, but never released it when such device is deleted. Deleting the underlying device via the ip tool cause the kernel to hangup in the netdev_wait_allrefs() loop. This commit ensure that on device unregistration dp_detach_port_notify() is called for all vports that hold the device reference, properly releasing it. Fixes: 614732eaa12d ("openvswitch: Use regular VXLAN net_device device") Fixes: b2acd1dc3949 ("openvswitch: Use regular GRE net_device instead of vport") Fixes: 6b001e682e90 ("openvswitch: Use Geneve device.") Signed-off-by: Paolo Abeni Acked-by: Flavio Leitner Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Upstream: 131753030("openvswitch: fix hangup on vxlan/gre/geneve device deletion"). Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- diff --git a/datapath/dp_notify.c b/datapath/dp_notify.c index 9434c19c7..424f35d93 100644 --- a/datapath/dp_notify.c +++ b/datapath/dp_notify.c @@ -60,7 +60,7 @@ void ovs_dp_notify_wq(struct work_struct *work) struct hlist_node *n; hlist_for_each_entry_safe(vport, n, &dp->ports[i], dp_hash_node) { - if (vport->ops->type != OVS_VPORT_TYPE_NETDEV) + if (vport->ops->type == OVS_VPORT_TYPE_INTERNAL) continue; if (!(vport->dev->priv_flags & IFF_OVS_DATAPATH)) diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 21431d3c3..a1df79b2b 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -213,9 +213,15 @@ void ovs_netdev_tunnel_destroy(struct vport *vport) if (vport->dev->priv_flags & IFF_OVS_DATAPATH) ovs_netdev_detach_dev(vport); - /* Early release so we can unregister the device */ + /* We can be invoked by both explicit vport deletion and + * underlying netdev deregistration; delete the link only + * if it's not already shutting down. + */ + + if (vport->dev->reg_state == NETREG_REGISTERED) + rtnl_delete_link(vport->dev); + dev_put(vport->dev); - rtnl_delete_link(vport->dev); vport->dev = NULL; rtnl_unlock();