diff options
author | Jay Vosburgh <fubar@us.ibm.com> | 2007-10-17 20:37:50 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-23 20:32:00 -0400 |
commit | 6603a6f25e4bca922a7dfbf0bf03072d98850176 (patch) | |
tree | 1e62ef0fe037036542def53dca162618a8345132 /drivers/net/bonding/bond_alb.c | |
parent | 059fe7a578fba5bbb0fdc0365bfcf6218fa25eb0 (diff) |
bonding: Convert more locks to _bh, acquire rtnl, for new locking
Convert more lock acquisitions to _bh flavor to avoid deadlock
with workqueue activity and add acquisition of RTNL in appropriate places.
Affects ALB mode, as well as core bonding functions and sysfs.
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bonding/bond_alb.c')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index f2e2872c9b17..6db5d763f6b6 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -128,12 +128,12 @@ static inline u8 _simple_hash(const u8 *hash_start, int hash_size) | |||
128 | 128 | ||
129 | static inline void _lock_tx_hashtbl(struct bonding *bond) | 129 | static inline void _lock_tx_hashtbl(struct bonding *bond) |
130 | { | 130 | { |
131 | spin_lock(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); | 131 | spin_lock_bh(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); |
132 | } | 132 | } |
133 | 133 | ||
134 | static inline void _unlock_tx_hashtbl(struct bonding *bond) | 134 | static inline void _unlock_tx_hashtbl(struct bonding *bond) |
135 | { | 135 | { |
136 | spin_unlock(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); | 136 | spin_unlock_bh(&(BOND_ALB_INFO(bond).tx_hashtbl_lock)); |
137 | } | 137 | } |
138 | 138 | ||
139 | /* Caller must hold tx_hashtbl lock */ | 139 | /* Caller must hold tx_hashtbl lock */ |
@@ -305,12 +305,12 @@ static struct slave *tlb_choose_channel(struct bonding *bond, u32 hash_index, u3 | |||
305 | /*********************** rlb specific functions ***************************/ | 305 | /*********************** rlb specific functions ***************************/ |
306 | static inline void _lock_rx_hashtbl(struct bonding *bond) | 306 | static inline void _lock_rx_hashtbl(struct bonding *bond) |
307 | { | 307 | { |
308 | spin_lock(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | 308 | spin_lock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); |
309 | } | 309 | } |
310 | 310 | ||
311 | static inline void _unlock_rx_hashtbl(struct bonding *bond) | 311 | static inline void _unlock_rx_hashtbl(struct bonding *bond) |
312 | { | 312 | { |
313 | spin_unlock(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); | 313 | spin_unlock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock)); |
314 | } | 314 | } |
315 | 315 | ||
316 | /* when an ARP REPLY is received from a client update its info | 316 | /* when an ARP REPLY is received from a client update its info |
@@ -472,13 +472,13 @@ static void rlb_clear_slave(struct bonding *bond, struct slave *slave) | |||
472 | 472 | ||
473 | _unlock_rx_hashtbl(bond); | 473 | _unlock_rx_hashtbl(bond); |
474 | 474 | ||
475 | write_lock(&bond->curr_slave_lock); | 475 | write_lock_bh(&bond->curr_slave_lock); |
476 | 476 | ||
477 | if (slave != bond->curr_active_slave) { | 477 | if (slave != bond->curr_active_slave) { |
478 | rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); | 478 | rlb_teach_disabled_mac_on_primary(bond, slave->dev->dev_addr); |
479 | } | 479 | } |
480 | 480 | ||
481 | write_unlock(&bond->curr_slave_lock); | 481 | write_unlock_bh(&bond->curr_slave_lock); |
482 | } | 482 | } |
483 | 483 | ||
484 | static void rlb_update_client(struct rlb_client_info *client_info) | 484 | static void rlb_update_client(struct rlb_client_info *client_info) |
@@ -1519,11 +1519,11 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave) | |||
1519 | /* caller must hold the bond lock for write since the mac addresses | 1519 | /* caller must hold the bond lock for write since the mac addresses |
1520 | * are compared and may be swapped. | 1520 | * are compared and may be swapped. |
1521 | */ | 1521 | */ |
1522 | write_lock_bh(&bond->lock); | 1522 | read_lock(&bond->lock); |
1523 | 1523 | ||
1524 | res = alb_handle_addr_collision_on_attach(bond, slave); | 1524 | res = alb_handle_addr_collision_on_attach(bond, slave); |
1525 | 1525 | ||
1526 | write_unlock_bh(&bond->lock); | 1526 | read_unlock(&bond->lock); |
1527 | 1527 | ||
1528 | if (res) { | 1528 | if (res) { |
1529 | return res; | 1529 | return res; |