Skip to content

Commit

Permalink
openvswitch: fix hangup on vxlan/gre/geneve device deletion
Browse files Browse the repository at this point in the history
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: 614732e ("openvswitch: Use regular VXLAN net_device device")
Fixes: b2acd1d ("openvswitch: Use regular GRE net_device instead of vport")
Fixes: 6b001e6 ("openvswitch: Use Geneve device.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Paolo Abeni authored and davem330 committed Dec 3, 2015
1 parent 4eba7bb commit 1317530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion net/openvswitch/dp_notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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))
Expand Down
8 changes: 6 additions & 2 deletions net/openvswitch/vport-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,13 @@ 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();

Expand Down

0 comments on commit 1317530

Please sign in to comment.