Commit d64393ae authored by Wensong Zhang's avatar Wensong Zhang Committed by Stephen Hemminger

[IPVS]: Fix to set the statistics of dest zero when bound to a new service

parent e801de94
...@@ -650,6 +650,15 @@ static void ip_vs_trash_cleanup(void) ...@@ -650,6 +650,15 @@ static void ip_vs_trash_cleanup(void)
} }
static void
ip_vs_zero_stats(struct ip_vs_stats *stats)
{
spin_lock_bh(&stats->lock);
memset(stats, 0, (char *)&stats->lock - (char *)stats);
spin_unlock_bh(&stats->lock);
ip_vs_zero_estimator(stats);
}
/* /*
* Update a destination in the given service * Update a destination in the given service
*/ */
...@@ -689,6 +698,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc, ...@@ -689,6 +698,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc,
} else { } else {
if (dest->svc != svc) { if (dest->svc != svc) {
__ip_vs_unbind_svc(dest); __ip_vs_unbind_svc(dest);
ip_vs_zero_stats(&dest->stats);
__ip_vs_bind_svc(dest, svc); __ip_vs_bind_svc(dest, svc);
} }
} }
...@@ -1296,15 +1306,6 @@ static int ip_vs_flush(void) ...@@ -1296,15 +1306,6 @@ static int ip_vs_flush(void)
/* /*
* Zero counters in a service or all services * Zero counters in a service or all services
*/ */
static void
ip_vs_zero_stats(struct ip_vs_stats *stats)
{
spin_lock_bh(&stats->lock);
memset(stats, 0, (char *)&stats->lock - (char *)stats);
spin_unlock_bh(&stats->lock);
ip_vs_zero_estimator(stats);
}
static int ip_vs_zero_service(struct ip_vs_service *svc) static int ip_vs_zero_service(struct ip_vs_service *svc)
{ {
struct ip_vs_dest *dest; struct ip_vs_dest *dest;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment