Commit d67fed98 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

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: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
Link: https://lore.kernel.org/r/20240408190437.2214473-3-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6c5d1714
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment