linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bonding/802.3ad: fix link_failure_count tracking
@ 2018-11-01 21:22 Jarod Wilson
  2018-11-03  7:01 ` David Miller
  2018-11-04 19:59 ` [PATCH net v2] " Jarod Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: Jarod Wilson @ 2018-11-01 21:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jarod Wilson, Mahesh Bandewar, David S . Miller, netdev, stable

Commit 4d2c0cda07448ea6980f00102dc3964eb25e241c set slave->link to
BOND_LINK_DOWN for 802.3ad bonds whenever invalid speed/duplex values
were read, to fix a problem with slaves getting into weird states, but
in the process, broke tracking of link failures, as going straight to
BOND_LINK_DOWN when a link is indeed down (cable pulled, switch rebooted)
means we broke out of bond_miimon_inspect()'s BOND_LINK_DOWN case because
!link_state was already true, we never incremented commit, and never got
a chance to call bond_miimon_commit(), where slave->link_failure_count
would be incremented. I believe the simple fix here is to mark the slave
as BOND_LINK_FAIL, and let bond_miimon_inspect() transition the link from
_FAIL to either _UP or _DOWN, and in the latter case, we now get proper
incrementing of link_failure_count again.

Fixes: 4d2c0cda07448ea6980f00102dc3964eb25e241c
CC: Mahesh Bandewar <maheshb@google.com>
CC: David S. Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
CC: stable@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ffa37adb7681..333387f1f1fe 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3112,13 +3112,13 @@ static int bond_slave_netdev_event(unsigned long event,
 	case NETDEV_CHANGE:
 		/* For 802.3ad mode only:
 		 * Getting invalid Speed/Duplex values here will put slave
-		 * in weird state. So mark it as link-down for the time
+		 * in weird state. So mark it as link-fail for the time
 		 * being and let link-monitoring (miimon) set it right when
 		 * correct speeds/duplex are available.
 		 */
 		if (bond_update_speed_duplex(slave) &&
 		    BOND_MODE(bond) == BOND_MODE_8023AD)
-			slave->link = BOND_LINK_DOWN;
+			slave->link = BOND_LINK_FAIL;
 
 		if (BOND_MODE(bond) == BOND_MODE_8023AD)
 			bond_3ad_adapter_speed_duplex_changed(slave);
-- 
2.16.1


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

* Re: [PATCH net] bonding/802.3ad: fix link_failure_count tracking
  2018-11-01 21:22 [PATCH net] bonding/802.3ad: fix link_failure_count tracking Jarod Wilson
@ 2018-11-03  7:01 ` David Miller
  2018-11-04 19:59 ` [PATCH net v2] " Jarod Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-03  7:01 UTC (permalink / raw)
  To: jarod; +Cc: linux-kernel, maheshb, netdev, stable

From: Jarod Wilson <jarod@redhat.com>
Date: Thu,  1 Nov 2018 17:22:40 -0400

> Fixes: 4d2c0cda07448ea6980f00102dc3964eb25e241c

The Fixes tag format should be:

Fixes: $SHA1_ID ("Commit header line text.")

Where SHA1_ID has 12 digits of significance.

Thanks.

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

* [PATCH net v2] bonding/802.3ad: fix link_failure_count tracking
  2018-11-01 21:22 [PATCH net] bonding/802.3ad: fix link_failure_count tracking Jarod Wilson
  2018-11-03  7:01 ` David Miller
@ 2018-11-04 19:59 ` Jarod Wilson
  2018-11-05  0:45   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Jarod Wilson @ 2018-11-04 19:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jarod Wilson, Mahesh Bandewar, David S . Miller, netdev, stable

Commit 4d2c0cda07448ea6980f00102dc3964eb25e241c set slave->link to
BOND_LINK_DOWN for 802.3ad bonds whenever invalid speed/duplex values
were read, to fix a problem with slaves getting into weird states, but
in the process, broke tracking of link failures, as going straight to
BOND_LINK_DOWN when a link is indeed down (cable pulled, switch rebooted)
means we broke out of bond_miimon_inspect()'s BOND_LINK_DOWN case because
!link_state was already true, we never incremented commit, and never got
a chance to call bond_miimon_commit(), where slave->link_failure_count
would be incremented. I believe the simple fix here is to mark the slave
as BOND_LINK_FAIL, and let bond_miimon_inspect() transition the link from
_FAIL to either _UP or _DOWN, and in the latter case, we now get proper
incrementing of link_failure_count again.

Fixes: 4d2c0cda0744 ("bonding: speed/duplex update at NETDEV_UP event")
CC: Mahesh Bandewar <maheshb@google.com>
CC: David S. Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
CC: stable@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
v2: fix Fixes line

 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ffa37adb7681..333387f1f1fe 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3112,13 +3112,13 @@ static int bond_slave_netdev_event(unsigned long event,
 	case NETDEV_CHANGE:
 		/* For 802.3ad mode only:
 		 * Getting invalid Speed/Duplex values here will put slave
-		 * in weird state. So mark it as link-down for the time
+		 * in weird state. So mark it as link-fail for the time
 		 * being and let link-monitoring (miimon) set it right when
 		 * correct speeds/duplex are available.
 		 */
 		if (bond_update_speed_duplex(slave) &&
 		    BOND_MODE(bond) == BOND_MODE_8023AD)
-			slave->link = BOND_LINK_DOWN;
+			slave->link = BOND_LINK_FAIL;
 
 		if (BOND_MODE(bond) == BOND_MODE_8023AD)
 			bond_3ad_adapter_speed_duplex_changed(slave);
-- 
2.16.1


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

* Re: [PATCH net v2] bonding/802.3ad: fix link_failure_count tracking
  2018-11-04 19:59 ` [PATCH net v2] " Jarod Wilson
@ 2018-11-05  0:45   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-05  0:45 UTC (permalink / raw)
  To: jarod; +Cc: linux-kernel, maheshb, netdev, stable

From: Jarod Wilson <jarod@redhat.com>
Date: Sun,  4 Nov 2018 14:59:46 -0500

> Commit 4d2c0cda07448ea6980f00102dc3964eb25e241c set slave->link to
> BOND_LINK_DOWN for 802.3ad bonds whenever invalid speed/duplex values
> were read, to fix a problem with slaves getting into weird states, but
> in the process, broke tracking of link failures, as going straight to
> BOND_LINK_DOWN when a link is indeed down (cable pulled, switch rebooted)
> means we broke out of bond_miimon_inspect()'s BOND_LINK_DOWN case because
> !link_state was already true, we never incremented commit, and never got
> a chance to call bond_miimon_commit(), where slave->link_failure_count
> would be incremented. I believe the simple fix here is to mark the slave
> as BOND_LINK_FAIL, and let bond_miimon_inspect() transition the link from
> _FAIL to either _UP or _DOWN, and in the latter case, we now get proper
> incrementing of link_failure_count again.
> 
> Fixes: 4d2c0cda0744 ("bonding: speed/duplex update at NETDEV_UP event")
> CC: Mahesh Bandewar <maheshb@google.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: netdev@vger.kernel.org
> CC: stable@vger.kernel.org
> Signed-off-by: Jarod Wilson <jarod@redhat.com>
> ---
> v2: fix Fixes line

Applied and queued up for -stable.

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

end of thread, other threads:[~2018-11-05  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 21:22 [PATCH net] bonding/802.3ad: fix link_failure_count tracking Jarod Wilson
2018-11-03  7:01 ` David Miller
2018-11-04 19:59 ` [PATCH net v2] " Jarod Wilson
2018-11-05  0:45   ` David Miller

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).