提交 d0e81b7e 编写于 作者: J Jay Vosburgh 提交者: Jeff Garzik

bonding: Acquire correct locks in alb for promisc change

	Update ALB mode monitor to hold correct locks (RTNL and nothing
else) when calling dev_set_promiscuity.
Signed-off-by: NAndy Gospodarek <andy@greyhouse.net>
Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 6603a6f2
...@@ -1455,16 +1455,16 @@ void bond_alb_monitor(struct work_struct *work) ...@@ -1455,16 +1455,16 @@ void bond_alb_monitor(struct work_struct *work)
/* handle rlb stuff */ /* handle rlb stuff */
if (bond_info->rlb_enabled) { if (bond_info->rlb_enabled) {
/* the following code changes the promiscuity of the
* the curr_active_slave. It needs to be locked with a
* write lock to protect from other code that also
* sets the promiscuity.
*/
write_lock_bh(&bond->curr_slave_lock);
if (bond_info->primary_is_promisc && if (bond_info->primary_is_promisc &&
(++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) { (++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) {
/*
* dev_set_promiscuity requires rtnl and
* nothing else.
*/
read_unlock(&bond->lock);
rtnl_lock();
bond_info->rlb_promisc_timeout_counter = 0; bond_info->rlb_promisc_timeout_counter = 0;
/* If the primary was set to promiscuous mode /* If the primary was set to promiscuous mode
...@@ -1473,9 +1473,10 @@ void bond_alb_monitor(struct work_struct *work) ...@@ -1473,9 +1473,10 @@ void bond_alb_monitor(struct work_struct *work)
*/ */
dev_set_promiscuity(bond->curr_active_slave->dev, -1); dev_set_promiscuity(bond->curr_active_slave->dev, -1);
bond_info->primary_is_promisc = 0; bond_info->primary_is_promisc = 0;
}
write_unlock_bh(&bond->curr_slave_lock); rtnl_unlock();
read_lock(&bond->lock);
}
if (bond_info->rlb_rebalance) { if (bond_info->rlb_rebalance) {
bond_info->rlb_rebalance = 0; bond_info->rlb_rebalance = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册