]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: fix bond_get_stats()
authorEric Dumazet <edumazet@google.com>
Fri, 18 Mar 2016 00:23:36 +0000 (17:23 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Mar 2016 03:14:15 +0000 (23:14 -0400)
commit453f67f8761b634180b9e9e678aad4b7a1754527
tree76597e789e2eac26153f116c8dfe991f934bc96a
parenta0645c0fce5de7b8e6cae7528c64ff48556ab62a
bonding: fix bond_get_stats()

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 d714f17a6e01 ("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: d714f17a6e01 ("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>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c
include/net/bonding.h