From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiangning Yu Subject: [PATCH net] bonding: re-evaluate force_primary when the primary slave name changes Date: Thu, 7 Jun 2018 13:39:59 +0800 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable To: David Miller , Linux Kernel Network Developers Return-path: Received: from mail-qk0-f196.google.com ([209.85.220.196]:43616 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410AbeFGFkE (ORCPT ); Thu, 7 Jun 2018 01:40:04 -0400 Received: by mail-qk0-f196.google.com with SMTP id g126-v6so5557745qke.10 for ; Wed, 06 Jun 2018 22:40:04 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: From: Xiangning Yu There is a timing issue under active-standy mode, when bond_enslave() is called, bond->params.primary might not be initialized yet. Any time the primary slave string changes, bond->force_primary should be set to true to make sure the primary becomes the active slave. Signed-off-by: Xiangning Yu --- drivers/net/bonding/bond_options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/bonding/bond_options.c = b/drivers/net/bonding/bond_options.c index 8a945c9..98663c5 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -1142,6 +1142,7 @@ static int bond_option_primary_set(struct bonding = *bond, slave->dev->name); rcu_assign_pointer(bond->primary_slave, slave); strcpy(bond->params.primary, slave->dev->name); + bond->force_primary =3D true; bond_select_active_slave(bond); goto out; } --=20 1.8.3.1