summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-04-08 21:04:36 +0200
committerJakub Kicinski <kuba@kernel.org>2024-04-10 02:31:45 +0200
commitd67fed98caa1f3c517fd6af7b8f044d05f9e3e5d (patch)
treec6b6269c41e4c8b717609da97bc7d8156eebadac
parentbonding: no longer use RTNL in bonding_show_bonds() (diff)
downloadlinux-d67fed98caa1f3c517fd6af7b8f044d05f9e3e5d.tar.xz
linux-d67fed98caa1f3c517fd6af7b8f044d05f9e3e5d.zip
bonding: no longer use RTNL in bonding_show_slaves()
Slave devices are already RCU protected, simply switch to bond_for_each_slave_rcu(), Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com> Link: https://lore.kernel.org/r/20240408190437.2214473-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/bonding/bond_sysfs.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 9132033f85fb..75ee7ca36903 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -170,10 +170,9 @@ static ssize_t bonding_show_slaves(struct device *d,
struct slave *slave;
int res = 0;
- if (!rtnl_trylock())
- return restart_syscall();
+ rcu_read_lock();
- bond_for_each_slave(bond, slave, iter) {
+ bond_for_each_slave_rcu(bond, slave, iter) {
if (res > (PAGE_SIZE - IFNAMSIZ)) {
/* not enough space for another interface name */
if ((PAGE_SIZE - res) > 10)
@@ -184,7 +183,7 @@ static ssize_t bonding_show_slaves(struct device *d,
res += sysfs_emit_at(buf, res, "%s ", slave->dev->name);
}
- rtnl_unlock();
+ rcu_read_unlock();
if (res)
buf[res-1] = '\n'; /* eat the leftover space */