Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6460875rwb; Tue, 22 Nov 2022 13:49:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf72NA3j/m/fYqxcEq0yMcEfH9LQEk2bE3irWIOgd8nFATdd2lu5Mp+wytgIIWPVbmWqZ88q X-Received: by 2002:a17:907:2a08:b0:7ae:76a4:e393 with SMTP id fd8-20020a1709072a0800b007ae76a4e393mr21956466ejc.743.1669153755664; Tue, 22 Nov 2022 13:49:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669153755; cv=none; d=google.com; s=arc-20160816; b=fJjeRZ9Hv9MN5zraNqen1nKWHa2lFh79c5YhbTkjz+YioWAAJN7PHPwEK7Zuobeh+4 aNA3sGz6vgsJVuRhnRmTlGjw+/nky1GeqJW2MSrLPlSHG3HVKeJBDW5DRGFKtGktj65F X3l12kBPchF8P2YGQidS4EN8EMJzu4OCrF6QV4XuNOF1pY55x5WaoF6iWTex/sbXHD2F Mfq54L9BKCeS4uLmV0uO3SYuHuxg4s/W+hqWTbqBJjpJ/GvsD4YpNU5B5YIjMD0R0GnI BCQCF/OYjuOet0yOmEKZmGEbWEMLu8pqbuTZ6mkl1S7F9O7YusoOruvO2feWyUlcp+W3 Wkuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HPuBaWQRr8cpwhtPqmiKsJrBi/GFZSasH/SPpO6YLxs=; b=skAn8X/3v1bHeCpe+Vcj4Md98sJbe6lLF7g+m2MPPiafLd5u2xobuE0fiMlRMdx4rT Pkm9FIpGE/KwndBvnHxCoRPQs37W6Pgy+TMlPo+zjdrvE2oRRyXdm/4JJ7o4Hil1WQs7 /tMx4NutBWQCU+xKGY/cg4SoFyYoQEOPaD1AGXUvCxdY8G7glcqmQnxqYbpPLtAaesv6 f8paVvHDBPHnEJNSOgrPQJBWt2XMbNf/ePrpbDcZMWHKl6lnFlNRJL13dYyUv9J2L08l a1oh3VmsDspHMHM9acLGRDJC0NSl/TuFCmtSarkAphdgY3fOlgtghzU754Zi6ShOebHo JpDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=En3C8TfJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn42-20020a1709070d2a00b0078e319dcca7si13250636ejc.744.2022.11.22.13.48.52; Tue, 22 Nov 2022 13:49:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=En3C8TfJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbiKVVZl (ORCPT + 89 others); Tue, 22 Nov 2022 16:25:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235001AbiKVVZf (ORCPT ); Tue, 22 Nov 2022 16:25:35 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F39C8221F for ; Tue, 22 Nov 2022 13:24:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669152280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HPuBaWQRr8cpwhtPqmiKsJrBi/GFZSasH/SPpO6YLxs=; b=En3C8TfJB4axDyZqZhol9qeldmQ5fHapWMwr2nx48M5Wpin6oBcxnB9r0ZzeuFYxE4ztG7 Ym0iOXPSztCRzHD2QCoTGHJT2s21nHnOC1lIxKdN4HHKN8EKtlBGyVVv4qalzT+GLeSXfn +QlIh4nziBk+gCQ5G/aEpE/YQWMo3wk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-jh6kNTyaNHm9HmJfHgzvJg-1; Tue, 22 Nov 2022 16:24:36 -0500 X-MC-Unique: jh6kNTyaNHm9HmJfHgzvJg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A9FFC801585; Tue, 22 Nov 2022 21:24:35 +0000 (UTC) Received: from jtoppins.rdu.csb (unknown [10.22.32.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E8CC4B3FC6; Tue, 22 Nov 2022 21:24:35 +0000 (UTC) From: Jonathan Toppins To: "netdev @ vger . kernel . org" , pabeni@redhat.com Cc: Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/2] bonding: fix link recovery in mode 2 when updelay is nonzero Date: Tue, 22 Nov 2022 16:24:29 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before this change when a bond in mode 2 lost link, all of its slaves lost link, the bonding device would never recover even after the expiration of updelay. This change removes the updelay when the bond currently has no usable links. Conforming to bonding.txt section 13.1 paragraph 4. Fixes: 41f891004063 ("bonding: ignore updelay param when there is no active slave") Signed-off-by: Jonathan Toppins --- Notes: v2: * added fixes tag and reposted to net tree drivers/net/bonding/bond_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f298b9b3eb77..f747bd60d399 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2536,7 +2536,16 @@ static int bond_miimon_inspect(struct bonding *bond) struct slave *slave; bool ignore_updelay; - ignore_updelay = !rcu_dereference(bond->curr_active_slave); + if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) { + ignore_updelay = !rcu_dereference(bond->curr_active_slave); + } else { + struct bond_up_slave *usable_slaves; + + usable_slaves = rcu_dereference(bond->usable_slaves); + + if (usable_slaves && usable_slaves->count == 0) + ignore_updelay = true; + } bond_for_each_slave_rcu(bond, slave, iter) { bond_propose_link_state(slave, BOND_LINK_NOCHANGE); -- 2.31.1