[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <17355.1712695044@famine>
Date: Tue, 09 Apr 2024 13:37:24 -0700
From: Jay Vosburgh <jay.vosburgh@...onical.com>
To: Eric Dumazet <edumazet@...gle.com>
cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Andy Gospodarek <andy@...yhouse.net>, netdev@...r.kernel.org,
eric.dumazet@...il.com
Subject: Re: [PATCH net-next 2/3] bonding: no longer use RTNL in bonding_show_slaves()
Eric Dumazet <edumazet@...gle.com> wrote:
>Slave devices are already RCU protected, simply
>switch to bond_for_each_slave_rcu(),
>
>Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Acked-by: Jay Vosburgh <jay.vosburgh@...onical.com>
>---
> drivers/net/bonding/bond_sysfs.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>index 9132033f85fb0e33093e97c55f885a997c95cb4a..75ee7ca369034ef6fa58fc9399b566dd7044fedc 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 */
>--
>2.44.0.478.gd926399ef9-goog
>
>
Powered by blists - more mailing lists