diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-04-15 13:23:03 -0700 |
---|---|---|
committer | Jesse Gross <jesse@nicira.com> | 2013-04-15 14:38:40 -0700 |
commit | 8e4e1713e4978447c5f799aa668dcc6d2cb0dee9 (patch) | |
tree | dc0c2e05b677183d617d74020fa9d1ed28691102 /net/openvswitch/vport-internal_dev.c | |
parent | b4f9e8cdc82e4a07c3ca50395af5800a6229363e (diff) | |
download | lwn-8e4e1713e4978447c5f799aa668dcc6d2cb0dee9.tar.gz lwn-8e4e1713e4978447c5f799aa668dcc6d2cb0dee9.zip |
openvswitch: Simplify datapath locking.
Currently OVS uses combination of genl and rtnl lock to protect
datapath state. This was done due to networking stack locking.
But this has complicated locking and there are few lock ordering
issues with new tunneling protocols.
Following patch simplifies locking by introducing new ovs mutex
and now this lock is used to protect entire ovs state.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'net/openvswitch/vport-internal_dev.c')
-rw-r--r-- | net/openvswitch/vport-internal_dev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 40f8a2489c90..9604760494b1 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c @@ -173,16 +173,19 @@ static struct vport *internal_dev_create(const struct vport_parms *parms) if (vport->port_no == OVSP_LOCAL) netdev_vport->dev->features |= NETIF_F_NETNS_LOCAL; + rtnl_lock(); err = register_netdevice(netdev_vport->dev); if (err) goto error_free_netdev; dev_set_promiscuity(netdev_vport->dev, 1); + rtnl_unlock(); netif_start_queue(netdev_vport->dev); return vport; error_free_netdev: + rtnl_unlock(); free_netdev(netdev_vport->dev); error_free_vport: ovs_vport_free(vport); @@ -195,10 +198,13 @@ static void internal_dev_destroy(struct vport *vport) struct netdev_vport *netdev_vport = netdev_vport_priv(vport); netif_stop_queue(netdev_vport->dev); + rtnl_lock(); dev_set_promiscuity(netdev_vport->dev, -1); /* unregister_netdevice() waits for an RCU grace period. */ unregister_netdevice(netdev_vport->dev); + + rtnl_unlock(); } static int internal_dev_recv(struct vport *vport, struct sk_buff *skb) |