diff options
author | Eric Dumazet <edumazet@google.com> | 2016-03-17 17:23:36 -0700 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-07-10 23:07:05 -0400 |
commit | 6acfc65a07790d15de590a2441ab55f51d36733a (patch) | |
tree | a1283509455a0c45dde99b3883cfe3dee6039500 /include | |
parent | 1fdc6943a177598ea960188f8972808bfa20dd84 (diff) | |
download | lwn-6acfc65a07790d15de590a2441ab55f51d36733a.tar.gz lwn-6acfc65a07790d15de590a2441ab55f51d36733a.zip |
bonding: fix bond_get_stats()
[ Upstream commit fe30937b65354c7fec244caebbdaae68e28ca797 ]
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>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/bonding.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/net/bonding.h b/include/net/bonding.h index 78ed135e9dea..5cba8f3c3fe4 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -211,6 +211,7 @@ struct bonding { * ALB mode (6) - to sync the use and modifications of its hash table */ spinlock_t mode_lock; + spinlock_t stats_lock; u8 send_peer_notif; u8 igmp_retrans; #ifdef CONFIG_PROC_FS |