From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Zhang Changzhong <zhangchangzhong@huawei.com>
Cc: Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Jeff Garzik <jeff@garzik.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] bonding: force carrier update when releasing slave
Date: Thu, 17 Feb 2022 10:40:26 -0800 [thread overview]
Message-ID: <18166.1645123226@famine> (raw)
In-Reply-To: <1645021088-38370-1-git-send-email-zhangchangzhong@huawei.com>
Zhang Changzhong <zhangchangzhong@huawei.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@huawei.com>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.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
>
next prev parent reply other threads:[~2022-02-17 18:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 14:18 [PATCH net] bonding: force carrier update when releasing slave Zhang Changzhong
2022-02-17 18:40 ` Jay Vosburgh [this message]
2022-02-17 19:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18166.1645123226@famine \
--to=jay.vosburgh@canonical.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=jeff@garzik.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
--cc=zhangchangzhong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).