]> git.hungrycats.org Git - linux/commitdiff
bonding: re-evaluate force_primary when the primary slave name changes
authorXiangning Yu <yuxiangning@gmail.com>
Thu, 7 Jun 2018 05:39:59 +0000 (13:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jul 2018 09:21:25 +0000 (11:21 +0200)
[ Upstream commit eb55bbf865d9979098c6a7a17cbdb41237ece951 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/bonding/bond_options.c

index 55e93b6b6d2150f2687f36bdeebe5db8c4ab2b01..66560a8fcfa2ff87ba78569ff9f43ae9814cd81e 100644 (file)
@@ -1115,6 +1115,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;
                }