diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-09-09 17:16:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-09 20:31:35 -0400 |
commit | bdbc5f13036c13ba47dad5f99645556fc40381f0 (patch) | |
tree | 60a9fb60ce94cd8b16212c5d45f0d69873f7c3bc /drivers/net/bonding | |
parent | 51752afa735ab28b6023fcf22ec63955107f8a65 (diff) |
bonding: 3ad: use curr_slave_lock instead of bond->lock
In 3ad mode the only syncing needed by bond->lock is for the wq
and the recv handler, so change them to use curr_slave_lock.
There're no locking dependencies here as 3ad doesn't use
curr_slave_lock at all.
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.c | 9 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 12 |
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index ee2c73a9de39..5d27a6207384 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->lock); | 2060 | read_lock(&bond->curr_slave_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->lock); | 2123 | read_unlock(&bond->curr_slave_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); |
@@ -2395,7 +2395,6 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond, | |||
2395 | return 0; | 2395 | return 0; |
2396 | } | 2396 | } |
2397 | 2397 | ||
2398 | /* Wrapper used to hold bond->lock so no slave manipulation can occur */ | ||
2399 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) | 2398 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info) |
2400 | { | 2399 | { |
2401 | int ret; | 2400 | int ret; |
@@ -2487,9 +2486,9 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, | |||
2487 | if (!lacpdu) | 2486 | if (!lacpdu) |
2488 | return ret; | 2487 | return ret; |
2489 | 2488 | ||
2490 | read_lock(&bond->lock); | 2489 | read_lock(&bond->curr_slave_lock); |
2491 | ret = bond_3ad_rx_indication(lacpdu, slave, skb->len); | 2490 | ret = bond_3ad_rx_indication(lacpdu, slave, skb->len); |
2492 | read_unlock(&bond->lock); | 2491 | read_unlock(&bond->curr_slave_lock); |
2493 | return ret; | 2492 | return ret; |
2494 | } | 2493 | } |
2495 | 2494 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f0f5eab0fab1..dcd331bd0c17 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1687,13 +1687,15 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1687 | * for this slave anymore. | 1687 | * for this slave anymore. |
1688 | */ | 1688 | */ |
1689 | netdev_rx_handler_unregister(slave_dev); | 1689 | netdev_rx_handler_unregister(slave_dev); |
1690 | write_lock_bh(&bond->lock); | ||
1691 | 1690 | ||
1692 | /* Inform AD package of unbinding of slave. */ | 1691 | if (BOND_MODE(bond) == BOND_MODE_8023AD) { |
1693 | if (BOND_MODE(bond) == BOND_MODE_8023AD) | 1692 | /* Sync against bond_3ad_rx_indication and |
1693 | * bond_3ad_state_machine_handler | ||
1694 | */ | ||
1695 | write_lock_bh(&bond->curr_slave_lock); | ||
1694 | bond_3ad_unbind_slave(slave); | 1696 | bond_3ad_unbind_slave(slave); |
1695 | 1697 | write_unlock_bh(&bond->curr_slave_lock); | |
1696 | write_unlock_bh(&bond->lock); | 1698 | } |
1697 | 1699 | ||
1698 | netdev_info(bond_dev, "Releasing %s interface %s\n", | 1700 | netdev_info(bond_dev, "Releasing %s interface %s\n", |
1699 | bond_is_active_slave(slave) ? "active" : "backup", | 1701 | bond_is_active_slave(slave) ? "active" : "backup", |