]> Pileus Git - ~andy/linux/blobdiff - net/netfilter/ipvs/ip_vs_wrr.c
Merge tag 'cleanup-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / net / netfilter / ipvs / ip_vs_wrr.c
index 98cb05e345c9e07755747275f25807810a5db12e..0e68555bceb9122a00283c147c977fbba01e4079 100644 (file)
@@ -129,7 +129,7 @@ static int ip_vs_wrr_init_svc(struct ip_vs_service *svc)
 }
 
 
-static int ip_vs_wrr_done_svc(struct ip_vs_service *svc)
+static void ip_vs_wrr_done_svc(struct ip_vs_service *svc)
 {
        struct ip_vs_wrr_mark *mark = svc->sched_data;
 
@@ -137,8 +137,6 @@ static int ip_vs_wrr_done_svc(struct ip_vs_service *svc)
         *    Release the mark variable
         */
        kfree_rcu(mark, rcu_head);
-
-       return 0;
 }
 
 
@@ -147,7 +145,7 @@ static int ip_vs_wrr_dest_changed(struct ip_vs_service *svc,
 {
        struct ip_vs_wrr_mark *mark = svc->sched_data;
 
-       write_lock_bh(&svc->sched_lock);
+       spin_lock_bh(&svc->sched_lock);
        mark->cl = list_entry(&svc->destinations, struct ip_vs_dest, n_list);
        mark->di = ip_vs_wrr_gcd_weight(svc);
        mark->mw = ip_vs_wrr_max_weight(svc) - (mark->di - 1);
@@ -155,7 +153,7 @@ static int ip_vs_wrr_dest_changed(struct ip_vs_service *svc,
                mark->cw = mark->mw;
        else if (mark->di > 1)
                mark->cw = (mark->cw / mark->di) * mark->di + 1;
-       write_unlock_bh(&svc->sched_lock);
+       spin_unlock_bh(&svc->sched_lock);
        return 0;
 }
 
@@ -172,7 +170,7 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
 
        IP_VS_DBG(6, "%s(): Scheduling...\n", __func__);
 
-       write_lock(&svc->sched_lock);
+       spin_lock_bh(&svc->sched_lock);
        dest = mark->cl;
        /* No available dests? */
        if (mark->mw == 0)
@@ -224,7 +222,7 @@ found:
        mark->cl = dest;
 
   out:
-       write_unlock(&svc->sched_lock);
+       spin_unlock_bh(&svc->sched_lock);
        return dest;
 
 err_noavail:
@@ -263,6 +261,7 @@ static int __init ip_vs_wrr_init(void)
 static void __exit ip_vs_wrr_cleanup(void)
 {
        unregister_ip_vs_scheduler(&ip_vs_wrr_scheduler);
+       synchronize_rcu();
 }
 
 module_init(ip_vs_wrr_init);