]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: force carrier update when releasing slave
authorZhang Changzhong <zhangchangzhong@huawei.com>
Wed, 16 Feb 2022 14:18:08 +0000 (22:18 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 17 Feb 2022 18:55:21 +0000 (10:55 -0800)
commitbb89aad2f1022bcef3eb7ee285bad4a6199af72c
treeed167d7da2ecd7e8607faef3362518519222458c
parentc88beab9d7c4a0e77cc5010d77a9875bf6dce6b4
bonding: force carrier update when releasing slave

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: 97b6eb2bb9ed ("[PATCH] bonding: support carrier state for master")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Link: https://lore.kernel.org/r/1645021088-38370-1-git-send-email-zhangchangzhong@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/bonding/bond_main.c