linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: in balance-rr mode, set curr_active_slave only if it is up
@ 2012-11-22 12:48 Michal Kubecek
  2012-11-25 21:03 ` David Miller
  2012-11-26 18:36 ` Jay Vosburgh
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Kubecek @ 2012-11-22 12:48 UTC (permalink / raw)
  To: netdev; +Cc: Jay Vosburgh, Andy Gospodarek, linux-kernel

If all slaves of a balance-rr bond with ARP monitor are enslaved
with down link state, bond keeps down state even after slaves
go up.

This is caused by bond_enslave() setting curr_active_slave to
first slave not taking into account its link state. As
bond_loadbalance_arp_mon() uses curr_active_slave to identify
whether slave's down->up transition should update bond's link
state, bond stays down even if slaves are up (until first slave
goes from up to down at least once).

Before commit f31c7937 "bonding: start slaves with link down for
ARP monitor", this was masked by slaves always starting in UP
state with ARP monitor (and MII monitor not relying on
curr_active_slave being NULL if there is no slave up).

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 drivers/net/bonding/bond_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5f5b69f..c8bff3e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1838,7 +1838,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 		 * anyway (it holds no special properties of the bond device),
 		 * so we can change it without calling change_active_interface()
 		 */
-		if (!bond->curr_active_slave)
+		if (!bond->curr_active_slave && new_slave->link == BOND_LINK_UP)
 			bond->curr_active_slave = new_slave;
 
 		break;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bonding: in balance-rr mode, set curr_active_slave only if it is up
  2012-11-22 12:48 [PATCH] bonding: in balance-rr mode, set curr_active_slave only if it is up Michal Kubecek
@ 2012-11-25 21:03 ` David Miller
  2012-11-26 18:36 ` Jay Vosburgh
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-11-25 21:03 UTC (permalink / raw)
  To: mkubecek; +Cc: netdev, fubar, andy, linux-kernel

From: Michal Kubecek <mkubecek@suse.cz>
Date: Thu, 22 Nov 2012 13:48:39 +0100

> If all slaves of a balance-rr bond with ARP monitor are enslaved
> with down link state, bond keeps down state even after slaves
> go up.
> 
> This is caused by bond_enslave() setting curr_active_slave to
> first slave not taking into account its link state. As
> bond_loadbalance_arp_mon() uses curr_active_slave to identify
> whether slave's down->up transition should update bond's link
> state, bond stays down even if slaves are up (until first slave
> goes from up to down at least once).
> 
> Before commit f31c7937 "bonding: start slaves with link down for
> ARP monitor", this was masked by slaves always starting in UP
> state with ARP monitor (and MII monitor not relying on
> curr_active_slave being NULL if there is no slave up).
> 
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>

Jay/Andy please review.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bonding: in balance-rr mode, set curr_active_slave only if it is up
  2012-11-22 12:48 [PATCH] bonding: in balance-rr mode, set curr_active_slave only if it is up Michal Kubecek
  2012-11-25 21:03 ` David Miller
@ 2012-11-26 18:36 ` Jay Vosburgh
  1 sibling, 0 replies; 3+ messages in thread
From: Jay Vosburgh @ 2012-11-26 18:36 UTC (permalink / raw)
  To: Michal Kubecek; +Cc: netdev, Andy Gospodarek, linux-kernel

Michal Kubecek <mkubecek@suse.cz> wrote:

>If all slaves of a balance-rr bond with ARP monitor are enslaved
>with down link state, bond keeps down state even after slaves
>go up.
>
>This is caused by bond_enslave() setting curr_active_slave to
>first slave not taking into account its link state. As
>bond_loadbalance_arp_mon() uses curr_active_slave to identify
>whether slave's down->up transition should update bond's link
>state, bond stays down even if slaves are up (until first slave
>goes from up to down at least once).

	The bond_loadbalance_arp_mon function actually uses
curr_active_slave to determine whether or not to do a "failover" (select
a new active slave), which in turn will call bond_set_carrier() from
within bond_select_active_slave().

	Other than that nitpick about the description, I see how setting
curr_active_slave to a down slave would cause loadbalance_arp_mon to
skip the "failover" step (because it presumes that an active slave is
always up, and therefore no new one needs to be selected), and thus skip
setting the master's carrier state.

	-J

>Before commit f31c7937 "bonding: start slaves with link down for
>ARP monitor", this was masked by slaves always starting in UP
>state with ARP monitor (and MII monitor not relying on
>curr_active_slave being NULL if there is no slave up).
>
>Signed-off-by: Michal Kubecek <mkubecek@suse.cz>

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>


> drivers/net/bonding/bond_main.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 5f5b69f..c8bff3e 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -1838,7 +1838,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
> 		 * anyway (it holds no special properties of the bond device),
> 		 * so we can change it without calling change_active_interface()
> 		 */
>-		if (!bond->curr_active_slave)
>+		if (!bond->curr_active_slave && new_slave->link == BOND_LINK_UP)
> 			bond->curr_active_slave = new_slave;
>
> 		break;
>-- 
>1.7.10.4
>

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-26 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22 12:48 [PATCH] bonding: in balance-rr mode, set curr_active_slave only if it is up Michal Kubecek
2012-11-25 21:03 ` David Miller
2012-11-26 18:36 ` Jay Vosburgh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).