[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 Jun 2018 03:18:23 -0700
From: Xiangning Yu <yuxiangning@...il.com>
To: Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Question about force_primary in bonding driver
Hi netdev folks,
While playing with bonding active-standby mode, we found a possible
timing issue that the primary might not initialized in bond_enslave():
if (bond_uses_primary(bond) && bond->params.primary[0]) {
/* if there is a primary slave, remember it */
if (strcmp(bond->params.primary, new_slave->dev->name) == 0) {
rcu_assign_pointer(bond->primary_slave, new_slave);
bond->force_primary = true;
}
}
Hence bond->force_primary won't be set and bond_select_active_slave()
ends up not selecting the primary slave as specified in bond params.
We applied the following patch to make sure force_primary is set when
primary is copied, and it seems to fix the issue. Could you please
provide some comments/thoughts on this?
Thank you very much!
- Xiangning
diff --git a/drivers/net/bonding/bond_options.c
b/drivers/net/bonding/bond_options.c
index 58c705f..b594bae 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;
}
Powered by blists - more mailing lists