aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-09-11 16:49:24 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-13 16:29:06 -0400
commit1c72cfdc96e63bf975cab514c4ca4d8a661ba0e6 (patch)
treeac7531a979920c5282f07fb71ad9f2c6a64d8ac4 /drivers/net/bonding/bond_options.c
parent62c5f5185397f4bd8e5defe6fcb86420deeb2b38 (diff)
bonding: clean curr_slave_lock use
Mostly all users of curr_slave_lock already have RTNL as we've discussed previously so there's no point in using it, the one case where the lock must stay is the 3ad code, in fact it's the only one. It's okay to remove it from bond_do_fail_over_mac() as it's called with RTNL and drops the curr_slave_lock anyway. bond_change_active_slave() is one of the main places where curr_slave_lock was used, it's okay to remove it as all callers use RTNL these days before calling it, that's why we move the ASSERT_RTNL() in the beginning to catch any potential offenders to this rule. The RTNL argument actually applies to all of the places where curr_slave_lock has been removed from in this patch. Also remove the unnecessary bond_deref_active_protected() macro and use rtnl_dereference() instead. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_options.c')
-rw-r--r--drivers/net/bonding/bond_options.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 534c0600484e..b62697f4a3de 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -734,15 +734,13 @@ static int bond_option_active_slave_set(struct bonding *bond,
734 } 734 }
735 735
736 block_netpoll_tx(); 736 block_netpoll_tx();
737 write_lock_bh(&bond->curr_slave_lock);
738
739 /* check to see if we are clearing active */ 737 /* check to see if we are clearing active */
740 if (!slave_dev) { 738 if (!slave_dev) {
741 netdev_info(bond->dev, "Clearing current active slave\n"); 739 netdev_info(bond->dev, "Clearing current active slave\n");
742 RCU_INIT_POINTER(bond->curr_active_slave, NULL); 740 RCU_INIT_POINTER(bond->curr_active_slave, NULL);
743 bond_select_active_slave(bond); 741 bond_select_active_slave(bond);
744 } else { 742 } else {
745 struct slave *old_active = bond_deref_active_protected(bond); 743 struct slave *old_active = rtnl_dereference(bond->curr_active_slave);
746 struct slave *new_active = bond_slave_get_rtnl(slave_dev); 744 struct slave *new_active = bond_slave_get_rtnl(slave_dev);
747 745
748 BUG_ON(!new_active); 746 BUG_ON(!new_active);
@@ -765,8 +763,6 @@ static int bond_option_active_slave_set(struct bonding *bond,
765 } 763 }
766 } 764 }
767 } 765 }
768
769 write_unlock_bh(&bond->curr_slave_lock);
770 unblock_netpoll_tx(); 766 unblock_netpoll_tx();
771 767
772 return ret; 768 return ret;
@@ -1066,7 +1062,6 @@ static int bond_option_primary_set(struct bonding *bond,
1066 struct slave *slave; 1062 struct slave *slave;
1067 1063
1068 block_netpoll_tx(); 1064 block_netpoll_tx();
1069 write_lock_bh(&bond->curr_slave_lock);
1070 1065
1071 p = strchr(primary, '\n'); 1066 p = strchr(primary, '\n');
1072 if (p) 1067 if (p)
@@ -1103,7 +1098,6 @@ static int bond_option_primary_set(struct bonding *bond,
1103 primary, bond->dev->name); 1098 primary, bond->dev->name);
1104 1099
1105out: 1100out:
1106 write_unlock_bh(&bond->curr_slave_lock);
1107 unblock_netpoll_tx(); 1101 unblock_netpoll_tx();
1108 1102
1109 return 0; 1103 return 0;
@@ -1117,9 +1111,7 @@ static int bond_option_primary_reselect_set(struct bonding *bond,
1117 bond->params.primary_reselect = newval->value; 1111 bond->params.primary_reselect = newval->value;
1118 1112
1119 block_netpoll_tx(); 1113 block_netpoll_tx();
1120 write_lock_bh(&bond->curr_slave_lock);
1121 bond_select_active_slave(bond); 1114 bond_select_active_slave(bond);
1122 write_unlock_bh(&bond->curr_slave_lock);
1123 unblock_netpoll_tx(); 1115 unblock_netpoll_tx();
1124 1116
1125 return 0; 1117 return 0;