aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPeter Pan(潘卫平) <panweiping3@gmail.com>2011-08-15 11:57:35 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-17 23:12:06 -0400
commitba3211ccd043fae3713793334d64d75bd0a1d029 (patch)
treeec0c004eabf168afec87fd1686e0aedf3041cfdf /drivers/net
parent8919bc13e8d92c5b082c5c0321567383a071f5bc (diff)
bonding:reset backup and inactive flag of slave
Eduard Sinelnikov (eduard.sinelnikov@gmail.com) found that if we change bonding mode from active backup to round robin, some slaves are still keeping "backup", and won't transmit packets. As Jay Vosburgh(fubar@us.ibm.com) pointed out that we can work around that by removing the bond_is_active_slave() check, because the "backup" flag is only meaningful for active backup mode. But if we just simply ignore the bond_is_active_slave() check, the transmission will work fine, but we can't maintain the correct value of "backup" flag for each slaves, though it is meaningless for other mode than active backup. I'd like to reset "backup" and "inactive" flag in bond_open, thus we can keep the correct value of them. As for bond_is_active_slave(), I'd like to prepare another patch to handle it. V2: Use C style comment. Move read_lock(&bond->curr_slave_lock). Replace restore with reset, for active backup mode, it means "restore", but for other modes, it means "reset". Signed-off-by: Weiping Pan <panweiping3@gmail.com> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 38a83acd502e..43f2ea541088 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3419,9 +3419,27 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
3419static int bond_open(struct net_device *bond_dev) 3419static int bond_open(struct net_device *bond_dev)
3420{ 3420{
3421 struct bonding *bond = netdev_priv(bond_dev); 3421 struct bonding *bond = netdev_priv(bond_dev);
3422 struct slave *slave;
3423 int i;
3422 3424
3423 bond->kill_timers = 0; 3425 bond->kill_timers = 0;
3424 3426
3427 /* reset slave->backup and slave->inactive */
3428 read_lock(&bond->lock);
3429 if (bond->slave_cnt > 0) {
3430 read_lock(&bond->curr_slave_lock);
3431 bond_for_each_slave(bond, slave, i) {
3432 if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP)
3433 && (slave != bond->curr_active_slave)) {
3434 bond_set_slave_inactive_flags(slave);
3435 } else {
3436 bond_set_slave_active_flags(slave);
3437 }
3438 }
3439 read_unlock(&bond->curr_slave_lock);
3440 }
3441 read_unlock(&bond->lock);
3442
3425 INIT_DELAYED_WORK(&bond->mcast_work, bond_resend_igmp_join_requests_delayed); 3443 INIT_DELAYED_WORK(&bond->mcast_work, bond_resend_igmp_join_requests_delayed);
3426 3444
3427 if (bond_is_lb(bond)) { 3445 if (bond_is_lb(bond)) {