vserver 2.0 rc7
[linux-2.6.git] / net / ipv4 / ipvs / ip_vs_wrr.c
index 5e02c8c..749fa04 100644 (file)
@@ -126,6 +126,8 @@ static int ip_vs_wrr_update_svc(struct ip_vs_service *svc)
        mark->cl = &svc->destinations;
        mark->mw = ip_vs_wrr_max_weight(svc);
        mark->di = ip_vs_wrr_gcd_weight(svc);
+       if (mark->cw > mark->mw)
+               mark->cw = 0;
        return 0;
 }
 
@@ -163,7 +165,7 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
                        if (mark->cw <= 0) {
                                mark->cw = mark->mw;
                                /*
-                                * Still zero, which means no availabe servers.
+                                * Still zero, which means no available servers.
                                 */
                                if (mark->cw == 0) {
                                        mark->cl = &svc->destinations;
@@ -186,7 +188,7 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
                        }
                }
 
-               if (mark->cl == p) {
+               if (mark->cl == p && mark->cw == mark->di) {
                        /* back to the start, and no dest is found.
                           It is only possible when all dests are OVERLOADED */
                        dest = NULL;