Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp805102pxb; Thu, 17 Feb 2022 15:22:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/kfsI/zJdUmfbtyQmwaqo/rYL4+awpzDu3HPWR+PkqVg36RkaQz69mMfGVQ6qeSIld8O8 X-Received: by 2002:a17:90a:e7ca:b0:1b9:66c8:982c with SMTP id kb10-20020a17090ae7ca00b001b966c8982cmr9553552pjb.30.1645140169822; Thu, 17 Feb 2022 15:22:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645140169; cv=none; d=google.com; s=arc-20160816; b=svmsPF5bpEcp8PzY2BS8u4TAHlgBcy1q/V5nH7yCyPXXcKqIw63a3u2IqmGW8kDunV AvGkFNSG3y3hRkHkHH/DIbpRG6RTY/fcxeFf3ObRBNH76PVUXO2lt8eJnrR+eZrixh4M RYrPOkb7eGgZDHFaH9CzpsbHPVWPlDR5/bcXvWD5uekqvsMpOKEgQixpEKJrAet+KLob xjjNVkdpKAfo2dAl4hir89kqOSKl8kEg/64g11vOnKrMVbjXzUpbt95aFtSNPzBEzLDH kwrLfvhTVbreAkekaWzvqb3NadJgj+d9t33IqwlzODwD3jATKAUEJXBis+mRtYnzXHfL aaqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:comments:references:in-reply-to:subject:cc :to:from:dkim-signature; bh=7ooOvkO5crxAahOT6RtL+CQVZ5kUZYq///EEcKWp2OU=; b=XEmkSCG8lSUg36mWnUQsNLmRYlWq6GGoqLQjl3CGZU/wngYGkm7cGnDlr/3hLAMyzK Zh3Q81f61F52arFmBUGeMf/3ORGOIomFW9Zewrh8aGIjyFkKWmPo6ZcRo0JdFUlg6Hdk 7on7vGeLg4w/Dwi7LQqKYyljky+PKPN1mfAMWNuHDMyEfnMaei040o3HnMoNCl5L2PAC ruCB/WACxMdeUaepiLsi+zmH8cBjgJ2s0wQw0a3l7JSb8tQ3KTMrmvNbApBvh/yZO4EW jxoA4lPALlAjVCAxyGtG7/tFHc31dFm71khLWtvJXM3STvrTB7QOn7iIjAfZ6IqSuDS0 xr8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=CkqDbVYm; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j6si1861712pjv.175.2022.02.17.15.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:22:49 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=CkqDbVYm; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F3ABA40927; Thu, 17 Feb 2022 15:08:35 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244440AbiBQSk6 (ORCPT + 99 others); Thu, 17 Feb 2022 13:40:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244424AbiBQSkp (ORCPT ); Thu, 17 Feb 2022 13:40:45 -0500 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4ECD4E382 for ; Thu, 17 Feb 2022 10:40:30 -0800 (PST) Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 557D93F1D0 for ; Thu, 17 Feb 2022 18:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645123229; bh=7ooOvkO5crxAahOT6RtL+CQVZ5kUZYq///EEcKWp2OU=; h=From:To:cc:Subject:In-reply-to:References:MIME-Version: Content-Type:Date:Message-ID; b=CkqDbVYmeSxzIP/DHPYvQRsrZg9pWdcKXbzGN3vNbBDomiDsOpJkwYEG7GkpORHev O4OznHuKkqznrY3oquwwRbgqysjRo/GI51+a8bzlqcCgEX+F+GpzBrHntO4sXNTv5s 6kXgzK9CSG04vwYQeuyJqOTKBHHW4jqSoc9VV99V2SlCNdoc2Clq2R5gb/vfdGUX2i D0DPi1V+QTo71zmxwCesUxw4W8KJsybjR2IrNiOir0+ZrmSTjRKtvcTLDvHZNFrjDA scSwXOZKZHMNLozuwMHOjrmoomcfY4PytPZm6dAtuz1tpLlFHL27agsoNusrrqGGy7 tiDCWhyXyf5IQ== Received: by mail-pj1-f71.google.com with SMTP id j23-20020a17090a7e9700b001b8626c9170so6905910pjl.1 for ; Thu, 17 Feb 2022 10:40:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :comments:mime-version:content-id:content-transfer-encoding:date :message-id; bh=7ooOvkO5crxAahOT6RtL+CQVZ5kUZYq///EEcKWp2OU=; b=DgKwB51OMNNPdQs52KE4ch4uJcfwH3dmeZJ/LpnxqyOHSIrj1M8+U7zaq68pqamI8s X0ZmBZWinw4FdrcynRMYe3W6Ly8Dl8aZ+SDAaK6Jn47/IumhxFeZE+POuNQagheBIx1X jxy76orILVMbtkbJejx8x7ZFfwXUZI+QDriKD/Auq4caR4CgFaENrdRLCt2JY6SN1+5X c//vfo13x0htS2Zyw3lauMWXYIiHgAUEC3w1/zTdMgXb/sSNjFYkfo4gGsytWh89oLF8 sT0Dlv6yh9ojNntnuzbHdZWnVOU/0nwk8Sg4HhWovGTcQO/tNe6sLg+T9VXUbJf/V5F1 j1dw== X-Gm-Message-State: AOAM533PtLZOMZ2uXrATXviD2Gg0rSYb6nSdyIRG1R2f+JIgxc1UA+dl a3eg5JiJkU4pI9Kon2PM4YHzgBUheuiUlT+JZnqGxw8QrWW9ZMioKIbFvgVmKtXrHsOfA5bEFWi I8pa3rdTLqMcbUpS//Pf+5Isa2OwgXBEMKieskwriAg== X-Received: by 2002:a62:7c41:0:b0:4e1:3185:cb21 with SMTP id x62-20020a627c41000000b004e13185cb21mr4335306pfc.82.1645123228104; Thu, 17 Feb 2022 10:40:28 -0800 (PST) X-Received: by 2002:a62:7c41:0:b0:4e1:3185:cb21 with SMTP id x62-20020a627c41000000b004e13185cb21mr4335291pfc.82.1645123227869; Thu, 17 Feb 2022 10:40:27 -0800 (PST) Received: from famine.localdomain ([50.125.80.157]) by smtp.gmail.com with ESMTPSA id n29sm8929844pgc.10.2022.02.17.10.40.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Feb 2022 10:40:27 -0800 (PST) Received: by famine.localdomain (Postfix, from userid 1000) id AC2D960DD1; Thu, 17 Feb 2022 10:40:26 -0800 (PST) Received: from famine (localhost [127.0.0.1]) by famine.localdomain (Postfix) with ESMTP id A4DFB9FAC3; Thu, 17 Feb 2022 10:40:26 -0800 (PST) From: Jay Vosburgh To: Zhang Changzhong cc: Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , Jeff Garzik , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] bonding: force carrier update when releasing slave In-reply-to: <1645021088-38370-1-git-send-email-zhangchangzhong@huawei.com> References: <1645021088-38370-1-git-send-email-zhangchangzhong@huawei.com> Comments: In-reply-to Zhang Changzhong message dated "Wed, 16 Feb 2022 22:18:08 +0800." X-Mailer: MH-E 8.6+git; nmh 1.6; Emacs 29.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18165.1645123226.1@famine> Content-Transfer-Encoding: quoted-printable Date: Thu, 17 Feb 2022 10:40:26 -0800 Message-ID: <18166.1645123226@famine> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Zhang Changzhong wrote: >In __bond_release_one(), bond_set_carrier() is only called when bond >device has no slave. Therefore, if we remove the up slave from a master >with two slaves and keep the down slave, the master will remain up. > >Fix this by moving bond_set_carrier() out of if (!bond_has_slaves(bond)) >statement. > >Reproducer: >$ insmod bonding.ko mode=3D0 miimon=3D100 max_bonds=3D2 >$ ifconfig bond0 up >$ ifenslave bond0 eth0 eth1 >$ ifconfig eth0 down >$ ifenslave -d bond0 eth1 >$ cat /proc/net/bonding/bond0 > >Fixes: ff59c4563a8d ("[PATCH] bonding: support carrier state for master") >Signed-off-by: Zhang Changzhong Acked-by: Jay Vosburgh >--- > drivers/net/bonding/bond_main.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > >diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_m= ain.c >index 238b56d..aebeb46 100644 >--- a/drivers/net/bonding/bond_main.c >+++ b/drivers/net/bonding/bond_main.c >@@ -2379,10 +2379,9 @@ static int __bond_release_one(struct net_device *b= ond_dev, > bond_select_active_slave(bond); > } > = >- if (!bond_has_slaves(bond)) { >- bond_set_carrier(bond); >+ bond_set_carrier(bond); >+ if (!bond_has_slaves(bond)) > eth_hw_addr_random(bond_dev); >- } > = > unblock_netpoll_tx(); > synchronize_rcu(); >-- = >2.9.5 >