From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
Andy Gospodarek <gospo@cumulusnetworks.com>,
Jay Vosburgh <j.vosburgh@gmail.com>,
Veaceslav Falico <vfalico@gmail.com>
Subject: Re: [PATCH net] bonding: fix bond_get_stats()
Date: Fri, 18 Mar 2016 12:26:44 +0100 [thread overview]
Message-ID: <56EBE5F4.6020003@cumulusnetworks.com> (raw)
In-Reply-To: <1458260616.31963.14.camel@edumazet-glaptop3.roam.corp.google.com>
On 03/18/2016 01:23 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> bond_get_stats() can be called from rtnetlink (with RTNL held)
> or from /proc/net/dev seq handler (with RCU held)
>
> The logic added in commit 5f0c5f73e5ef ("bonding: make global bonding
> stats more reliable") kind of assumed only one cpu could run there.
>
> If multiple threads are reading /proc/net/dev, stats can be really
> messed up after a while.
>
> A second problem is that some fields are 32bit, so we need to properly
> handle the wrap around problem.
>
> Given that RTNL is not always held, we need to use
> bond_for_each_slave_rcu().
>
> Fixes: 5f0c5f73e5ef ("bonding: make global bonding stats more reliable")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
> Cc: Jay Vosburgh <j.vosburgh@gmail.com>
> Cc: Veaceslav Falico <vfalico@gmail.com>
> ---
> drivers/net/bonding/bond_main.c | 66 +++++++++++++++---------------
> include/net/bonding.h | 1
> 2 files changed, 36 insertions(+), 31 deletions(-)
>
Good catches! And the dev_get_stats() in bond_enslave is fine because the slave
is not yet linked thus can't collide with reading/updating the stats via procfs.
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
next prev parent reply other threads:[~2016-03-18 11:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-18 0:23 [PATCH net] bonding: fix bond_get_stats() Eric Dumazet
2016-03-18 11:26 ` Nikolay Aleksandrov [this message]
2016-03-19 3:15 ` David Miller
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=56EBE5F4.6020003@cumulusnetworks.com \
--to=nikolay@cumulusnetworks.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=gospo@cumulusnetworks.com \
--cc=j.vosburgh@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.