aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-09-09 17:17:02 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-09 20:31:35 -0400
commit246df7b423aa61a8bd0b58404759a9abb4c15081 (patch)
treea143752f926a2738ecbf9d9d2e5da79850930418 /drivers/net/bonding
parente9fe8efeeae11f19bb6fafd6153ec77deaeb4b83 (diff)
bonding: options: remove bond->lock usage
We're safe to remove the bond->lock use from the arp targets because arp_rcv_probe no longer acquires bond->lock, only rcu_read_lock. Also setting the primary slave is safe because noone uses the bond->lock as a syncing mechanism for that anymore. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_options.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 7c9e176baecc..534c0600484e 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -955,14 +955,7 @@ static int _bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
955 955
956static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target) 956static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target)
957{ 957{
958 int ret; 958 return _bond_option_arp_ip_target_add(bond, target);
959
960 /* not to race with bond_arp_rcv */
961 write_lock_bh(&bond->lock);
962 ret = _bond_option_arp_ip_target_add(bond, target);
963 write_unlock_bh(&bond->lock);
964
965 return ret;
966} 959}
967 960
968static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target) 961static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
@@ -991,9 +984,6 @@ static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
991 984
992 netdev_info(bond->dev, "Removing ARP target %pI4\n", &target); 985 netdev_info(bond->dev, "Removing ARP target %pI4\n", &target);
993 986
994 /* not to race with bond_arp_rcv */
995 write_lock_bh(&bond->lock);
996
997 bond_for_each_slave(bond, slave, iter) { 987 bond_for_each_slave(bond, slave, iter) {
998 targets_rx = slave->target_last_arp_rx; 988 targets_rx = slave->target_last_arp_rx;
999 for (i = ind; (i < BOND_MAX_ARP_TARGETS-1) && targets[i+1]; i++) 989 for (i = ind; (i < BOND_MAX_ARP_TARGETS-1) && targets[i+1]; i++)
@@ -1004,8 +994,6 @@ static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target)
1004 targets[i] = targets[i+1]; 994 targets[i] = targets[i+1];
1005 targets[i] = 0; 995 targets[i] = 0;
1006 996
1007 write_unlock_bh(&bond->lock);
1008
1009 return 0; 997 return 0;
1010} 998}
1011 999
@@ -1013,11 +1001,8 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond)
1013{ 1001{
1014 int i; 1002 int i;
1015 1003
1016 /* not to race with bond_arp_rcv */
1017 write_lock_bh(&bond->lock);
1018 for (i = 0; i < BOND_MAX_ARP_TARGETS; i++) 1004 for (i = 0; i < BOND_MAX_ARP_TARGETS; i++)
1019 _bond_options_arp_ip_target_set(bond, i, 0, 0); 1005 _bond_options_arp_ip_target_set(bond, i, 0, 0);
1020 write_unlock_bh(&bond->lock);
1021} 1006}
1022 1007
1023static int bond_option_arp_ip_targets_set(struct bonding *bond, 1008static int bond_option_arp_ip_targets_set(struct bonding *bond,
@@ -1081,7 +1066,6 @@ static int bond_option_primary_set(struct bonding *bond,
1081 struct slave *slave; 1066 struct slave *slave;
1082 1067
1083 block_netpoll_tx(); 1068 block_netpoll_tx();
1084 read_lock(&bond->lock);
1085 write_lock_bh(&bond->curr_slave_lock); 1069 write_lock_bh(&bond->curr_slave_lock);
1086 1070
1087 p = strchr(primary, '\n'); 1071 p = strchr(primary, '\n');
@@ -1120,7 +1104,6 @@ static int bond_option_primary_set(struct bonding *bond,
1120 1104
1121out: 1105out:
1122 write_unlock_bh(&bond->curr_slave_lock); 1106 write_unlock_bh(&bond->curr_slave_lock);
1123 read_unlock(&bond->lock);
1124 unblock_netpoll_tx(); 1107 unblock_netpoll_tx();
1125 1108
1126 return 0; 1109 return 0;