diff options
Diffstat (limited to 'net/ipv4/ipvs/ip_vs_ctl.c')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index 9a5ace0b4dd6..6379705a8dcb 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -683,9 +683,22 @@ static void | |||
683 | ip_vs_zero_stats(struct ip_vs_stats *stats) | 683 | ip_vs_zero_stats(struct ip_vs_stats *stats) |
684 | { | 684 | { |
685 | spin_lock_bh(&stats->lock); | 685 | spin_lock_bh(&stats->lock); |
686 | memset(stats, 0, (char *)&stats->lock - (char *)stats); | 686 | |
687 | spin_unlock_bh(&stats->lock); | 687 | stats->conns = 0; |
688 | stats->inpkts = 0; | ||
689 | stats->outpkts = 0; | ||
690 | stats->inbytes = 0; | ||
691 | stats->outbytes = 0; | ||
692 | |||
693 | stats->cps = 0; | ||
694 | stats->inpps = 0; | ||
695 | stats->outpps = 0; | ||
696 | stats->inbps = 0; | ||
697 | stats->outbps = 0; | ||
698 | |||
688 | ip_vs_zero_estimator(stats); | 699 | ip_vs_zero_estimator(stats); |
700 | |||
701 | spin_unlock_bh(&stats->lock); | ||
689 | } | 702 | } |
690 | 703 | ||
691 | /* | 704 | /* |
@@ -1589,7 +1602,7 @@ static struct ctl_table vs_vars[] = { | |||
1589 | { .ctl_name = 0 } | 1602 | { .ctl_name = 0 } |
1590 | }; | 1603 | }; |
1591 | 1604 | ||
1592 | struct ctl_path net_vs_ctl_path[] = { | 1605 | const struct ctl_path net_vs_ctl_path[] = { |
1593 | { .procname = "net", .ctl_name = CTL_NET, }, | 1606 | { .procname = "net", .ctl_name = CTL_NET, }, |
1594 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, | 1607 | { .procname = "ipv4", .ctl_name = NET_IPV4, }, |
1595 | { .procname = "vs", }, | 1608 | { .procname = "vs", }, |
@@ -1784,7 +1797,9 @@ static const struct file_operations ip_vs_info_fops = { | |||
1784 | 1797 | ||
1785 | #endif | 1798 | #endif |
1786 | 1799 | ||
1787 | struct ip_vs_stats ip_vs_stats; | 1800 | struct ip_vs_stats ip_vs_stats = { |
1801 | .lock = __SPIN_LOCK_UNLOCKED(ip_vs_stats.lock), | ||
1802 | }; | ||
1788 | 1803 | ||
1789 | #ifdef CONFIG_PROC_FS | 1804 | #ifdef CONFIG_PROC_FS |
1790 | static int ip_vs_stats_show(struct seq_file *seq, void *v) | 1805 | static int ip_vs_stats_show(struct seq_file *seq, void *v) |
@@ -2306,7 +2321,7 @@ static struct nf_sockopt_ops ip_vs_sockopts = { | |||
2306 | }; | 2321 | }; |
2307 | 2322 | ||
2308 | 2323 | ||
2309 | int ip_vs_control_init(void) | 2324 | int __init ip_vs_control_init(void) |
2310 | { | 2325 | { |
2311 | int ret; | 2326 | int ret; |
2312 | int idx; | 2327 | int idx; |
@@ -2333,8 +2348,6 @@ int ip_vs_control_init(void) | |||
2333 | INIT_LIST_HEAD(&ip_vs_rtable[idx]); | 2348 | INIT_LIST_HEAD(&ip_vs_rtable[idx]); |
2334 | } | 2349 | } |
2335 | 2350 | ||
2336 | memset(&ip_vs_stats, 0, sizeof(ip_vs_stats)); | ||
2337 | spin_lock_init(&ip_vs_stats.lock); | ||
2338 | ip_vs_new_estimator(&ip_vs_stats); | 2351 | ip_vs_new_estimator(&ip_vs_stats); |
2339 | 2352 | ||
2340 | /* Hook the defense timer */ | 2353 | /* Hook the defense timer */ |