ipvs: zero percpu stats
Subsystems (3)
Julian Anastasov
maintainerPATCH 3/4 ipvs: zero percpu stats
Zero the new percpu stats because we copy from there.
Signed-off-by Julian Anastasov <[email protected]>
---
net/netfilter/ipvs/ip_vs_ctl.c renamed from linux/net/netfilter/ipvs/ip_vs_ctl.c +17 -0
@@ -713,8 +713,25 @@ static void ip_vs_trash_cleanup(struct nstatic void ip_vs_zero_stats (struct ip_vs_stats *stats) { +struct ip_vs_cpu_stats *cpustats = stats->cpustats; +int i; +spin_lock_bh (&stats->lock); +for_each_possible_cpu (i) { +struct ip_vs_cpu_stats *u =per_cpu_ptr (cpustats, i); +unsigned int start; + +/* Do not pretend to be writer, it is enough to +* sync with writers that modify the u64 counters +* because under stats->lock we are the only reader. +*/ +do { + start =u64_stats_fetch_begin (&u->syncp); +memset (&u->ustats,0 ,sizeof (u->ustats)); + }while (u64_stats_fetch_retry (&u->syncp, start)); + } +memset (&stats->ustats,0 ,sizeof (stats->ustats));ip_vs_zero_estimator (stats);