Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp479435ybi; Fri, 24 May 2019 06:51:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4ozIIHaaSHY/kILB/8OtL5ihrGEz15g8bH8FX9iP0ow48eL2GXobdfUWq6tkAv/nPSiSt X-Received: by 2002:a63:234c:: with SMTP id u12mr1708120pgm.264.1558705903371; Fri, 24 May 2019 06:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558705903; cv=none; d=google.com; s=arc-20160816; b=KvJPCmy0KokP/rHFsrnNddoQpOQ3xKq42rWYyLw3lrGO/X0sF2WIakMe8EJ3Noh9gM wbrsy9vMVdjOPsb2ztTtIcdayLYyS+ldvbkOEzBrFUXfJ5V8szZ2TWF0tlseA3srd2TH PMhBnEtJReMfP1+lAiuvpZSWOQuguGIDxjfGIK2T5yb3em0QgV00bSYXCBxWUeeb0aO0 IZjNriOJqo6ktU4FvQV3t3HAHfae6b+0+i8hMWzjWQ9OdKrAmyrQ7CIz77KG+8HvhaDK We9v0xOz8aSzCb00c8qkwu+rN8Fc1V+3kaaA510MlSr4vXfe1I9UlFjOp1kWrxZuK1XI adLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8DAJPAK9SEmQTQw9Jq395zIyk6PGP+smfu14dbrEXiU=; b=FINoWYt/xxeLV6nGiGIGtKyWotdDtklr3/IlDj28J0q7FR+rF9U3DheEOXyoyFXUlV ISlakS47lSi6R6+NXW/1qW/M3kPNJ7w6En5q2HAvmYAtfZb2V+9AFltky1ZPQzOvlERz f5kOGFVP+V7Ix62uRC5c+ON8ITEMMfS4VO7f515zZjVOUflhEwxwbl6rSt9WTZjy71qy XT5WLpB0dba80QdDc9gp3FHNQ3JMpjmKhewQAsGJGDjFyC/HlbhGQL+JKk2tgkKE51CV q/y+tVF2X3hFbAG6CscqjeiV+aImN3UL/j9VjF9bNGJ4S/nFTAnIMDrGArzbL6nIAxzR yY7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si414876pgp.299.2019.05.24.06.51.24; Fri, 24 May 2019 06:51:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403907AbfEXNt4 (ORCPT + 99 others); Fri, 24 May 2019 09:49:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41998 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403809AbfEXNt4 (ORCPT ); Fri, 24 May 2019 09:49:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B8E230BB546; Fri, 24 May 2019 13:49:50 +0000 (UTC) Received: from hp-dl360pgen8-07.khw2.lab.eng.bos.redhat.com (hp-dl360pgen8-07.khw2.lab.eng.bos.redhat.com [10.16.210.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32B3A7D67C; Fri, 24 May 2019 13:49:44 +0000 (UTC) From: Jarod Wilson To: linux-kernel@vger.kernel.org Cc: Jarod Wilson , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , netdev@vger.kernel.org, Heesoon Kim Subject: [PATCH net] bonding/802.3ad: fix slave link initialization transition states Date: Fri, 24 May 2019 09:49:28 -0400 Message-Id: <20190524134928.16834-1-jarod@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 24 May 2019 13:49:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/bonding/bond_main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 062fa7e3af4c..407f4095a37a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3122,13 +3122,18 @@ 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-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); -- 2.20.1