Skip to content

Commit

Permalink
net: remove synchronize_net() from netdev_set_master()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 23, 2011
1 parent ac3d3f8 commit 6df427f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 1 addition & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6df427f

Please sign in to comment.