Commit b7435628 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

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: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1c72cfdc
...@@ -2057,7 +2057,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) ...@@ -2057,7 +2057,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
struct port *port; struct port *port;
bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER; bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;
read_lock(&bond->curr_slave_lock); spin_lock_bh(&bond->mode_lock);
rcu_read_lock(); rcu_read_lock();
/* check if there are any slaves */ /* check if there are any slaves */
...@@ -2120,7 +2120,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) ...@@ -2120,7 +2120,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
} }
} }
rcu_read_unlock(); rcu_read_unlock();
read_unlock(&bond->curr_slave_lock); spin_unlock_bh(&bond->mode_lock);
if (should_notify_rtnl && rtnl_trylock()) { if (should_notify_rtnl && rtnl_trylock()) {
bond_slave_state_notify(bond); bond_slave_state_notify(bond);
......
...@@ -1679,9 +1679,9 @@ static int __bond_release_one(struct net_device *bond_dev, ...@@ -1679,9 +1679,9 @@ static int __bond_release_one(struct net_device *bond_dev,
/* Sync against bond_3ad_rx_indication and /* Sync against bond_3ad_rx_indication and
* bond_3ad_state_machine_handler * bond_3ad_state_machine_handler
*/ */
write_lock_bh(&bond->curr_slave_lock); spin_lock_bh(&bond->mode_lock);
bond_3ad_unbind_slave(slave); bond_3ad_unbind_slave(slave);
write_unlock_bh(&bond->curr_slave_lock); spin_unlock_bh(&bond->mode_lock);
} }
netdev_info(bond_dev, "Releasing %s interface %s\n", netdev_info(bond_dev, "Releasing %s interface %s\n",
...@@ -3850,8 +3850,7 @@ void bond_setup(struct net_device *bond_dev) ...@@ -3850,8 +3850,7 @@ void bond_setup(struct net_device *bond_dev)
{ {
struct bonding *bond = netdev_priv(bond_dev); struct bonding *bond = netdev_priv(bond_dev);
/* initialize rwlocks */ spin_lock_init(&bond->mode_lock);
rwlock_init(&bond->curr_slave_lock);
bond->params = bonding_defaults; bond->params = bonding_defaults;
/* Initialize pointers */ /* Initialize pointers */
......
...@@ -195,7 +195,7 @@ struct bonding { ...@@ -195,7 +195,7 @@ struct bonding {
s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
int (*recv_probe)(const struct sk_buff *, struct bonding *, int (*recv_probe)(const struct sk_buff *, struct bonding *,
struct slave *); struct slave *);
rwlock_t curr_slave_lock; spinlock_t mode_lock;
u8 send_peer_notif; u8 send_peer_notif;
u8 igmp_retrans; u8 igmp_retrans;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment