[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <18166.1645123226@famine>
Date: Thu, 17 Feb 2022 10:40:26 -0800
From: Jay Vosburgh <jay.vosburgh@...onical.com>
To: Zhang Changzhong <zhangchangzhong@...wei.com>
cc: Veaceslav Falico <vfalico@...il.com>,
Andy Gospodarek <andy@...yhouse.net>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jeff Garzik <jeff@...zik.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] bonding: force carrier update when releasing slave
Zhang Changzhong <zhangchangzhong@...wei.com> wrote:
>In __bond_release_one(), bond_set_carrier() is only called when bond
>device has no slave. Therefore, if we remove the up slave from a master
>with two slaves and keep the down slave, the master will remain up.
>
>Fix this by moving bond_set_carrier() out of if (!bond_has_slaves(bond))
>statement.
>
>Reproducer:
>$ insmod bonding.ko mode=0 miimon=100 max_bonds=2
>$ ifconfig bond0 up
>$ ifenslave bond0 eth0 eth1
>$ ifconfig eth0 down
>$ ifenslave -d bond0 eth1
>$ cat /proc/net/bonding/bond0
>
>Fixes: ff59c4563a8d ("[PATCH] bonding: support carrier state for master")
>Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
Acked-by: Jay Vosburgh <jay.vosburgh@...onical.com>
>---
> drivers/net/bonding/bond_main.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 238b56d..aebeb46 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -2379,10 +2379,9 @@ static int __bond_release_one(struct net_device *bond_dev,
> bond_select_active_slave(bond);
> }
>
>- if (!bond_has_slaves(bond)) {
>- bond_set_carrier(bond);
>+ bond_set_carrier(bond);
>+ if (!bond_has_slaves(bond))
> eth_hw_addr_random(bond_dev);
>- }
>
> unblock_netpoll_tx();
> synchronize_rcu();
>--
>2.9.5
>
Powered by blists - more mailing lists