netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bonding: re-evaluate force_primary when the primary slave name changes
@ 2018-06-07  5:39 Xiangning Yu
  2018-06-07 20:54 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Xiangning Yu @ 2018-06-07  5:39 UTC (permalink / raw)
  To: David Miller, Linux Kernel Network Developers

From: Xiangning Yu <yuxiangning@gmail.com>

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 <yuxiangning@gmail.com>
---
 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 = true;
 			bond_select_active_slave(bond);
 			goto out;
 		}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] bonding: re-evaluate force_primary when the primary slave name changes
  2018-06-07  5:39 [PATCH net] bonding: re-evaluate force_primary when the primary slave name changes Xiangning Yu
@ 2018-06-07 20:54 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-06-07 20:54 UTC (permalink / raw)
  To: yuxiangning; +Cc: netdev

From: Xiangning Yu <yuxiangning@gmail.com>
Date: Thu, 7 Jun 2018 13:39:59 +0800

> From: Xiangning Yu <yuxiangning@gmail.com>
> 
> 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 <yuxiangning@gmail.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-07 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-07  5:39 [PATCH net] bonding: re-evaluate force_primary when the primary slave name changes Xiangning Yu
2018-06-07 20:54 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).