aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-09-11 16:49:25 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-13 16:29:07 -0400
commitb743562819bd97cc7c282e870896bae8016b64b5 (patch)
tree609840f05bf9dd7c1d6fec0c6e447e305bd866a7 /drivers/net/bonding
parent1c72cfdc96e63bf975cab514c4ca4d8a661ba0e6 (diff)
bonding: convert curr_slave_lock to a spinlock and rename it
curr_slave_lock is now a misleading name, a much better name is mode_lock as it'll be used for each mode's purposes and it's no longer necessary to use a rwlock, a simple spinlock is enough. Suggested-by: Jay Vosburgh <jay.vosburgh@canonical.com> 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_3ad.c4
-rw-r--r--drivers/net/bonding/bond_main.c7
-rw-r--r--drivers/net/bonding/bonding.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index dfd3a7835d17..1824d1df4d09 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2057,7 +2057,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
2057 struct port *port; 2057 struct port *port;
2058 bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER; 2058 bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;
2059 2059
2060 read_lock(&bond->curr_slave_lock); 2060 spin_lock_bh(&bond->mode_lock);
2061 rcu_read_lock(); 2061 rcu_read_lock();
2062 2062
2063 /* check if there are any slaves */ 2063 /* check if there are any slaves */
@@ -2120,7 +2120,7 @@ re_arm:
2120 } 2120 }
2121 } 2121 }
2122 rcu_read_unlock(); 2122 rcu_read_unlock();
2123 read_unlock(&bond->curr_slave_lock); 2123 spin_unlock_bh(&bond->mode_lock);
2124 2124
2125 if (should_notify_rtnl && rtnl_trylock()) { 2125 if (should_notify_rtnl && rtnl_trylock()) {
2126 bond_slave_state_notify(bond); 2126 bond_slave_state_notify(bond);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3b06685260b8..99d21c2fd44f 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1679,9 +1679,9 @@ static int __bond_release_one(struct net_device *bond_dev,
1679 /* Sync against bond_3ad_rx_indication and 1679 /* Sync against bond_3ad_rx_indication and
1680 * bond_3ad_state_machine_handler 1680 * bond_3ad_state_machine_handler
1681 */ 1681 */
1682 write_lock_bh(&bond->curr_slave_lock); 1682 spin_lock_bh(&bond->mode_lock);
1683 bond_3ad_unbind_slave(slave); 1683 bond_3ad_unbind_slave(slave);
1684 write_unlock_bh(&bond->curr_slave_lock); 1684 spin_unlock_bh(&bond->mode_lock);
1685 } 1685 }
1686 1686
1687 netdev_info(bond_dev, "Releasing %s interface %s\n", 1687 netdev_info(bond_dev, "Releasing %s interface %s\n",
@@ -3850,8 +3850,7 @@ void bond_setup(struct net_device *bond_dev)
3850{ 3850{
3851 struct bonding *bond = netdev_priv(bond_dev); 3851 struct bonding *bond = netdev_priv(bond_dev);
3852 3852
3853 /* initialize rwlocks */ 3853 spin_lock_init(&bond->mode_lock);
3854 rwlock_init(&bond->curr_slave_lock);
3855 bond->params = bonding_defaults; 3854 bond->params = bonding_defaults;
3856 3855
3857 /* Initialize pointers */ 3856 /* Initialize pointers */
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 02afdeb08765..0cda34b827f8 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -195,7 +195,7 @@ struct bonding {
195 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ 195 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
196 int (*recv_probe)(const struct sk_buff *, struct bonding *, 196 int (*recv_probe)(const struct sk_buff *, struct bonding *,
197 struct slave *); 197 struct slave *);
198 rwlock_t curr_slave_lock; 198 spinlock_t mode_lock;
199 u8 send_peer_notif; 199 u8 send_peer_notif;
200 u8 igmp_retrans; 200 u8 igmp_retrans;
201#ifdef CONFIG_PROC_FS 201#ifdef CONFIG_PROC_FS