Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4397318pxb; Mon, 21 Feb 2022 20:14:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxsM1B0zfcLsZGRbPIZXQ7mwQ1l5RNpSS+xLIGTMgTAywjgvySyDFTejJQrCjbuBV6XfY7 X-Received: by 2002:a63:6d46:0:b0:373:c08a:eca8 with SMTP id i67-20020a636d46000000b00373c08aeca8mr16475586pgc.429.1645503272870; Mon, 21 Feb 2022 20:14:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645503272; cv=none; d=google.com; s=arc-20160816; b=aBJbr1MPJRLnW+nAMzValciD+E08EX/cRAi/4NhbRbfpP2XQ1e5kMoTXVhWNlEFCRu /R5rd6FIU8nrRwx2uegDP2Y7XSbq+RpJpTsJEwICj52OUImef/jIa3bCArCWKXTo1MBs cE9J+Rb50pjSjI2USx6CWlvMJdWIIAzdr2Yp/l59umiUoZdCtOfvtsgcoUqivuS61xSm qFO/dpmb+Fk6uU2Q36ktkNY8NbxRYbUvcp6kzdEjPC/jijqH9eaxVB8f8el+8QlhfwRd I4RALJPRcouyXS+AGoT9YbbpmWMqfA4jc4OFVryxMct4EgwL8CmKaAW+BqN/cOfPF1DX cUSA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pPjXX+QUnJQCMLtFXsx+jsnjsgTF6JqlZl7rrJQg0uk=; b=faZozSZde3ekAa7J9pfkU4/T8+8IfpsIFJAtX02R2twV4QpJJJFPMsl0ZiPrC0NvTr oUjg3wTKuPKODlVQEt07rYmMSuhxX4LZm+sjsb56eVN/sDWLBj8Gm7jnZTsYXjSdnNmk zBEIAoPbfV8ofj7G7sMRY3sDDXLGNvXdlAw5Mbl/wipEHy4vqL1tqoqjxjjYcEvr8Y7J JxB277y4d21HA/a5gvd53MiIpfU8N1x8TcUndndQ+ETBJ5VFT8iVLY6Yy7vwGTYl57Vk jFGSSQYqc4qgE7jR4odKbWIX4AEEwikiaV5xwYTAdU3dsds+3JBVbTLbfxADPmclKVrz 4T/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xSjEvJmd; 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=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id rj13-20020a17090b3e8d00b001bc13b4ed1asi1052220pjb.41.2022.02.21.20.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:14:32 -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=@linuxfoundation.org header.s=korg header.b=xSjEvJmd; 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=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 967B685655; Mon, 21 Feb 2022 20:14:20 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353794AbiBUKCU (ORCPT + 99 others); Mon, 21 Feb 2022 05:02:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352103AbiBUJwv (ORCPT ); Mon, 21 Feb 2022 04:52:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DD76366BB; Mon, 21 Feb 2022 01:23:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C3BCB80EB6; Mon, 21 Feb 2022 09:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61129C340F0; Mon, 21 Feb 2022 09:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435395; bh=w5JvrDHpQHi9hP3iLoc3bRhVvq0c0cSFfbvoy6Wvri0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xSjEvJmdH2TjCO8WM5rqgaz/aWYAkT8teXzFUK2HLnZkcbne4U9CN8NYN2MpqM1bI AC9h+tDtISf2wI5zqzmjf11FE/Z3o/svvDBFxiGYg9NCla/pzBShb415fVyMWKw+am GWl1NGPHgw7LRP+9x8CCGavil0P9dSJ3fmSptNqc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Changzhong , Jay Vosburgh , Jakub Kicinski Subject: [PATCH 5.16 116/227] bonding: force carrier update when releasing slave Date: Mon, 21 Feb 2022 09:48:55 +0100 Message-Id: <20220221084938.721469800@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 From: Zhang Changzhong commit a6ab75cec1e461f8a35559054c146c21428430b8 upstream. 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=0 miimon=100 max_bonds=2 $ 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 Link: https://lore.kernel.org/r/1645021088-38370-1-git-send-email-zhangchangzhong@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2377,10 +2377,9 @@ static int __bond_release_one(struct net 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();