Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1274238pxb; Thu, 15 Apr 2021 19:46:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyde9W2O2f3QqnpJgEUmyUSCKSz1zxu/0GifVxWZpO5S1/wJNlHc+3/NIyVBOfVtZg0HnRf X-Received: by 2002:a17:90a:5903:: with SMTP id k3mr6985146pji.225.1618541163335; Thu, 15 Apr 2021 19:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618541163; cv=none; d=google.com; s=arc-20160816; b=qNpnqr2E1uy0Zu99wo5G/dtrKJLEfIALnQeQ44jCPaFdNcW1hZ2L2Nz4CJW3fMmw36 8xRVBZP81tS/4fDiodsSyVB5h7O9/5QODTB38zMZl5Sxyji5P9mhDL8OlwN83dVExBm3 ZII6J/S35z3IeFfZJuOyVrBKpmBZmKM0U/BWMUlwebWNxs1eOhp0CEjdFNpsvh09lFcW /DgewlVmuOJjutVMxWlTXhSd6wVwna4c5xAsjGIBbzw9yv8eSFm6DNJWizaScKveEt3l WlRmah+A5vNJnYXNty96ynld2iKJ7gVkJuQq/Tj3PTwtkEoVcqYvBQf3fpkRed2s0ghD 1dVQ== 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 :message-id:date:subject:cc:to:from; bh=ok+w0QwD+xwkA5YI7OQYb8t68DHwUzs0yfob9CLj50Y=; b=lCD+YTBm2O8vwWI0r+DhoNTLxibK6Y6xSiIjMekIyFv0U9e97XIVAZ94g95zOz4d0W SeNN6kj0R7YrCdaACKn6AQkJp/MFnHPMiakvUL05LsB5M1MkCFBggySJdWLYeQKdMSUX Cz1wT3FjxUizJ1HYJxpUCD71hYP3GgoTxbVRNHnZN3Qa/ERmB2ZEuSyIcpVwldrCHSG9 E6COv23VbCa8hBmDXDc4VjkVtZVhbLHMvDEgVVDNpKLTqbBjrOZIqvViMFBuynDrbc73 DGmlx7WpBgikhtADTRi1IbpemVVc92L5T1BugQAaEQ7bVqseDasgTfBJLmN02z+IZXTB T2iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si5872659pjn.73.2021.04.15.19.45.50; Thu, 15 Apr 2021 19:46:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237938AbhDPByn (ORCPT + 99 others); Thu, 15 Apr 2021 21:54:43 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:16927 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235043AbhDPBym (ORCPT ); Thu, 15 Apr 2021 21:54:42 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FLzjh0lxCzkkW7; Fri, 16 Apr 2021 09:52:24 +0800 (CST) Received: from huawei.com (10.175.112.154) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Fri, 16 Apr 2021 09:54:07 +0800 From: jinyiting To: , , , , , , , CC: , Subject: [PATCH] bonding: 3ad: update slave arr after initialize Date: Fri, 16 Apr 2021 09:53:02 +0800 Message-ID: <1618537982-454-1-git-send-email-jinyiting@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.175.112.154] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: jin yiting The bond works in mode 4, and performs down/up operations on the bond that is normally negotiated. The probability of bond-> slave_arr is NULL Test commands: ifconfig bond1 down ifconfig bond1 up The conflict occurs in the following process: __dev_open (CPU A) --bond_open --queue_delayed_work(bond->wq,&bond->ad_work,0); --bond_update_slave_arr --bond_3ad_get_active_agg_info ad_work(CPU B) --bond_3ad_state_machine_handler --ad_agg_selection_logic ad_work runs on cpu B. In the function ad_agg_selection_logic, all agg->is_active will be cleared. Before the new active aggregator is selected on CPU B, bond_3ad_get_active_agg_info failed on CPU A, bond->slave_arr will be set to NULL. The best aggregator in ad_agg_selection_logic has not changed, no need to update slave arr. Signed-off-by: jin yiting --- drivers/net/bonding/bond_3ad.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 6908822..d100079 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -2327,6 +2327,12 @@ void bond_3ad_state_machine_handler(struct work_struct *work) aggregator = __get_first_agg(port); ad_agg_selection_logic(aggregator, &update_slave_arr); + if (!update_slave_arr) { + struct aggregator *active = __get_active_agg(aggregator); + + if (active && active->is_active) + update_slave_arr = true; + } } bond_3ad_set_carrier(bond); } -- 1.7.12.4