summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-05-19 19:37:40 +0000
committerDavid S. Miller <davem@davemloft.net>2011-05-22 21:01:20 -0400
commit6df427fe8c481d3be437cbe8bd366bdac82b73c4 (patch)
tree5107145d367b646f815493bfcee75e2c0abfca3b
parentac3d3f81516fcbf80416e84682fd4bdaf3080611 (diff)
downloadlwn-6df427fe8c481d3be437cbe8bd366bdac82b73c4.tar.gz
lwn-6df427fe8c481d3be437cbe8bd366bdac82b73c4.zip
net: remove synchronize_net() from netdev_set_master()
In the old days, we used to access dev->master in __netif_receive_skb() in a rcu_read_lock section. So one synchronize_net() call was needed in netdev_set_master() to make sure another cpu could not use old master while/after we release it. We now use netdev_rx_handler infrastructure and added one synchronize_net() call in bond_release()/bond_release_all() Remove the obsolete synchronize_net() from netdev_set_master() and add one in bridge del_nbp() after its netdev_rx_handler_unregister() call. This makes enslave -d a bit faster. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Jiri Pirko <jpirko@redhat.com> CC: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/bridge/br_if.c1
-rw-r--r--net/core/dev.c4
2 files changed, 2 insertions, 3 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index d5147ddd70bf..1bacca4cb676 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -147,6 +147,7 @@ static void del_nbp(struct net_bridge_port *p)
dev->priv_flags &= ~IFF_BRIDGE_PORT;
netdev_rx_handler_unregister(dev);
+ synchronize_net();
netdev_set_master(dev, NULL);
diff --git a/net/core/dev.c b/net/core/dev.c
index d94537914a71..bcb05cb799c1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4294,10 +4294,8 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
slave->master = master;
- if (old) {
- synchronize_net();
+ if (old)
dev_put(old);
- }
return 0;
}
EXPORT_SYMBOL(netdev_set_master);