diff options
author | Julian Anastasov <ja@ssi.bg> | 2013-09-12 11:21:10 +0300 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2013-09-18 14:40:20 -0500 |
commit | d1ee4fea0b6946dd8bc61b46db35ea80af7af34b (patch) | |
tree | a44e72832ed85b3ed661dc6ac93e439abb1bbf72 /net | |
parent | 742617b176909e586a4cf9b142c996c25986fce8 (diff) | |
download | op-kernel-dev-d1ee4fea0b6946dd8bc61b46db35ea80af7af34b.zip op-kernel-dev-d1ee4fea0b6946dd8bc61b46db35ea80af7af34b.tar.gz |
ipvs: stats should not depend on CPU 0
When reading percpu stats we need to properly reset
the sum when CPU 0 is not present in the possible mask.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/ipvs/ip_vs_est.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c index 6bee6d0..1425e9a 100644 --- a/net/netfilter/ipvs/ip_vs_est.c +++ b/net/netfilter/ipvs/ip_vs_est.c @@ -59,12 +59,13 @@ static void ip_vs_read_cpu_stats(struct ip_vs_stats_user *sum, struct ip_vs_cpu_stats __percpu *stats) { int i; + bool add = false; for_each_possible_cpu(i) { struct ip_vs_cpu_stats *s = per_cpu_ptr(stats, i); unsigned int start; __u64 inbytes, outbytes; - if (i) { + if (add) { sum->conns += s->ustats.conns; sum->inpkts += s->ustats.inpkts; sum->outpkts += s->ustats.outpkts; @@ -76,6 +77,7 @@ static void ip_vs_read_cpu_stats(struct ip_vs_stats_user *sum, sum->inbytes += inbytes; sum->outbytes += outbytes; } else { + add = true; sum->conns = s->ustats.conns; sum->inpkts = s->ustats.inpkts; sum->outpkts = s->ustats.outpkts; |