Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[cascardo/linux.git] / net / netfilter / ipvs / ip_vs_ctl.c
index 3934987..35be035 100644 (file)
@@ -842,7 +842,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
               struct ip_vs_dest **dest_p)
 {
        struct ip_vs_dest *dest;
-       unsigned int atype;
+       unsigned int atype, i;
 
        EnterFunction(2);
 
@@ -869,6 +869,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
        if (!dest->stats.cpustats)
                goto err_alloc;
 
+       for_each_possible_cpu(i) {
+               struct ip_vs_cpu_stats *ip_vs_dest_stats;
+               ip_vs_dest_stats = per_cpu_ptr(dest->stats.cpustats, i);
+               u64_stats_init(&ip_vs_dest_stats->syncp);
+       }
+
        dest->af = svc->af;
        dest->protocol = svc->protocol;
        dest->vaddr = svc->addr;
@@ -1134,7 +1140,7 @@ static int
 ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
                  struct ip_vs_service **svc_p)
 {
-       int ret = 0;
+       int ret = 0, i;
        struct ip_vs_scheduler *sched = NULL;
        struct ip_vs_pe *pe = NULL;
        struct ip_vs_service *svc = NULL;
@@ -1184,6 +1190,13 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
                goto out_err;
        }
 
+       for_each_possible_cpu(i) {
+               struct ip_vs_cpu_stats *ip_vs_stats;
+               ip_vs_stats = per_cpu_ptr(svc->stats.cpustats, i);
+               u64_stats_init(&ip_vs_stats->syncp);
+       }
+
+
        /* I'm the first user of the service */
        atomic_set(&svc->refcnt, 0);
 
@@ -3780,7 +3793,7 @@ static struct notifier_block ip_vs_dst_notifier = {
 
 int __net_init ip_vs_control_net_init(struct net *net)
 {
-       int idx;
+       int i, idx;
        struct netns_ipvs *ipvs = net_ipvs(net);
 
        /* Initialize rs_table */
@@ -3799,6 +3812,12 @@ int __net_init ip_vs_control_net_init(struct net *net)
        if (!ipvs->tot_stats.cpustats)
                return -ENOMEM;
 
+       for_each_possible_cpu(i) {
+               struct ip_vs_cpu_stats *ipvs_tot_stats;
+               ipvs_tot_stats = per_cpu_ptr(ipvs->tot_stats.cpustats, i);
+               u64_stats_init(&ipvs_tot_stats->syncp);
+       }
+
        spin_lock_init(&ipvs->tot_stats.lock);
 
        proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops);