From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andy Gospodarek <andy@greyhouse.net>,
netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 2/3] bonding: no longer use RTNL in bonding_show_slaves()
Date: Tue, 09 Apr 2024 13:37:24 -0700 [thread overview]
Message-ID: <17355.1712695044@famine> (raw)
In-Reply-To: <20240408190437.2214473-3-edumazet@google.com>
Eric Dumazet <edumazet@google.com> wrote:
>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>
>---
> 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
>
>
next prev parent reply other threads:[~2024-04-09 20:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 19:04 [PATCH net-next 0/3] bonding: remove RTNL from three sysfs files Eric Dumazet
2024-04-08 19:04 ` [PATCH net-next 1/3] bonding: no longer use RTNL in bonding_show_bonds() Eric Dumazet
2024-04-09 20:37 ` Jay Vosburgh
2024-04-08 19:04 ` [PATCH net-next 2/3] bonding: no longer use RTNL in bonding_show_slaves() Eric Dumazet
2024-04-09 20:37 ` Jay Vosburgh [this message]
2024-04-08 19:04 ` [PATCH net-next 3/3] bonding: no longer use RTNL in bonding_show_queue_id() Eric Dumazet
2024-04-09 20:39 ` Jay Vosburgh
2024-04-09 20:47 ` Eric Dumazet
2024-04-09 20:53 ` Jay Vosburgh
2024-04-10 0:40 ` [PATCH net-next 0/3] bonding: remove RTNL from three sysfs files 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=17355.1712695044@famine \
--to=jay.vosburgh@canonical.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).