DORMANTno replies

[PATCH net-next 8/9] bonding: remove unwanted lock for bond enslave and release

From: Ding Tianhong <hidden>
Date: 2013-11-06 06:54:02
Subsystem: bonding driver, networking drivers, the rest · Maintainers: Jay Vosburgh, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

The bond_change_active_slave() and bond_select_active_slave()
was no longer need bond lock and curr_slave_lock, the enslave
and release will always in RTNL, so remove the unwanted lock.

Signed-off-by: Ding Tianhong <redacted>
---
 drivers/net/bonding/bond_main.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index dc17a85..d2d70dc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1565,13 +1565,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 	bond_compute_features(bond);
 	bond_set_carrier(bond);
 
-	if (USES_PRIMARY(bond->params.mode)) {
-		read_lock(&bond->lock);
-		write_lock_bh(&bond->curr_slave_lock);
+	if (USES_PRIMARY(bond->params.mode))
 		bond_select_active_slave(bond);
-		write_unlock_bh(&bond->curr_slave_lock);
-		read_unlock(&bond->lock);
-	}
 
 	pr_info("%s: enslaving %s as a%s interface with a%s link.\n",
 		bond_dev->name, slave_dev->name,
@@ -1590,19 +1585,11 @@ err_detach:
 		bond_hw_addr_flush(bond_dev, slave_dev);
 
 	vlan_vids_del_by_dev(slave_dev, bond_dev);
-	write_lock_bh(&bond->lock);
 	if (bond->primary_slave == new_slave)
 		bond->primary_slave = NULL;
 	if (bond->curr_active_slave == new_slave) {
 		bond_change_active_slave(bond, NULL);
-		write_unlock_bh(&bond->lock);
-		read_lock(&bond->lock);
-		write_lock_bh(&bond->curr_slave_lock);
 		bond_select_active_slave(bond);
-		write_unlock_bh(&bond->curr_slave_lock);
-		read_unlock(&bond->lock);
-	} else {
-		write_unlock_bh(&bond->lock);
 	}
 	slave_disable_netpoll(new_slave);
 
@@ -1743,13 +1730,9 @@ static int __bond_release_one(struct net_device *bond_dev,
 		 * will interfere.
 		 */
 		write_unlock_bh(&bond->lock);
-		read_lock(&bond->lock);
-		write_lock_bh(&bond->curr_slave_lock);
 
 		bond_select_active_slave(bond);
 
-		write_unlock_bh(&bond->curr_slave_lock);
-		read_unlock(&bond->lock);
 		write_lock_bh(&bond->lock);
 	}
 
-- 
1.8.2.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help