From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A78AC04AB6 for ; Mon, 3 Jun 2019 09:17:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 422C725660 for ; Mon, 3 Jun 2019 09:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559553456; bh=wKRkOxxi0rWgjjdvH42irIrb7H/TvTZPRbgRF8ZF4o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IJWfg10jCWrjl8mjtJDzMzfYODm7XaABOq/+WAZztkBqQHS07vufm2lGeM8MatNKn jqHxGi5bYSnkWwoNW3Y1KGKbewpi7dcqS8p+B6mPeDHZ81f80VQBYQ6+DE3ISyIloY Ywg7A62FG1Z5ed3H+ZY8/LTXXEaALCdmD+MZVchE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728316AbfFCJLL (ORCPT ); Mon, 3 Jun 2019 05:11:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:56014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728302AbfFCJLK (ORCPT ); Mon, 3 Jun 2019 05:11:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B5AC27E36; Mon, 3 Jun 2019 09:11:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559553069; bh=wKRkOxxi0rWgjjdvH42irIrb7H/TvTZPRbgRF8ZF4o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S8NuzwFiP4/7M5GN4pyLznQz0hGS2EmARSfKYpLNCogowH5dDgNi8aA+dpEngg3GX 6u15ARH51C1Jcer7ii5tI4XlS/BMfcsb6+wIwpKOfq9AIsq9qS9G2YEHpR4+QkfLRZ tv5RC1mzcyVToXGGSW+rlbm0a0TOn74orba7Ynv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , netdev@vger.kernel.org, Heesoon Kim , Jarod Wilson , Jay Vosburgh Subject: [PATCH 5.0 01/36] bonding/802.3ad: fix slave link initialization transition states Date: Mon, 3 Jun 2019 11:08:49 +0200 Message-Id: <20190603090521.077564611@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190603090520.998342694@linuxfoundation.org> References: <20190603090520.998342694@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jarod Wilson [ Upstream commit 334031219a84b9994594015aab85ed7754c80176 ] Once in a while, with just the right timing, 802.3ad slaves will fail to properly initialize, winding up in a weird state, with a partner system mac address of 00:00:00:00:00:00. This started happening after a fix to properly track link_failure_count tracking, where an 802.3ad slave that reported itself as link up in the miimon code, but wasn't able to get a valid speed/duplex, started getting set to BOND_LINK_FAIL instead of BOND_LINK_DOWN. That was the proper thing to do for the general "my link went down" case, but has created a link initialization race that can put the interface in this odd state. The simple fix is to instead set the slave link to BOND_LINK_DOWN again, if the link has never been up (last_link_up == 0), so the link state doesn't bounce from BOND_LINK_DOWN to BOND_LINK_FAIL -- it hasn't failed in this case, it simply hasn't been up yet, and this prevents the unnecessary state change from DOWN to FAIL and getting stuck in an init failure w/o a partner mac. Fixes: ea53abfab960 ("bonding/802.3ad: fix link_failure_count tracking") CC: Jay Vosburgh CC: Veaceslav Falico CC: Andy Gospodarek CC: "David S. Miller" CC: netdev@vger.kernel.org Tested-by: Heesoon Kim Signed-off-by: Jarod Wilson Acked-by: Jay Vosburgh Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3123,13 +3123,18 @@ static int bond_slave_netdev_event(unsig 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-fail for the time - * being and let link-monitoring (miimon) set it right when - * correct speeds/duplex are available. + * in weird state. Mark it as link-fail if the link was + * previously up or link-down if it hasn't yet come up, 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_FAIL; + BOND_MODE(bond) == BOND_MODE_8023AD) { + if (slave->last_link_up) + slave->link = BOND_LINK_FAIL; + else + slave->link = BOND_LINK_DOWN; + } if (BOND_MODE(bond) == BOND_MODE_8023AD) bond_3ad_adapter_speed_duplex_changed(slave);