LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

[Patch] Overload flag is not resetting

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>, Wensong Zhang <wensong@xxxxxxxxxxxx>
Subject: [Patch] Overload flag is not resetting
From: Horms <horms@xxxxxxxxxxxx>
Date: Fri, 4 Feb 2005 15:18:07 +0900
On Fri, Feb 04, 2005 at 12:54:31PM +0900, Horms wrote:
> On Thu, Jan 20, 2005 at 09:52:27PM +0100, Kees Hoekzema wrote:
> > Hello list,
> > 
> > Seems my debugging was not totally correct; it is not the 
> > IP_VS_DEST_F_OVERLOAD that causes the problem, but the check 
> > 'atomic_read(&dest->weight) >= mark->cw'.
> > 
> > So I went on debugging, it seems that the current weight isn't altered when 
> > a server is updated, so that if the servers drop quite heavily in weight 
> > (due to a ddos or whatever) than you can run the risk of a connection 
> > refused because no server is available because the new weights are much 
> > lower than the old current weight, especially if you lower them drasticly.
> > 
> > I've added 'mark->cw = 0;' to ip_vs_wrr_update_svc(..) to prevent a 
> > connection refused if you happen to like changing the weights a lot ;).
> > 
> > I'm not entirely sure if this is going to affect the services, but at least 
> > it wont prevent any clients from connecting ;)
> > 
> > The 'patch' (against a 2.6.10 vanilla kernel):
> > 
> > diff -Naur linux-vanilla-2.6.10/net/ipv4/ipvs/ip_vs_wrr.c 
> > linux-2.6.10/net/ipv4/ipvs/ip_vs_wrr.c
> > --- linux-vanilla-2.6.10/net/ipv4/ipvs/ip_vs_wrr.c      2004-12-24 
> > 22:33:49.000000000 +0100
> > +++ linux-2.6.10/net/ipv4/ipvs/ip_vs_wrr.c      2005-01-20 
> > 21:43:36.000000000 +0100
> > @@ -124,6 +124,7 @@
> >         struct ip_vs_wrr_mark *mark = svc->sched_data;
> > 
> >         mark->cl = &svc->destinations;
> > +        mark->cw = 0;
> >         mark->mw = ip_vs_wrr_max_weight(svc);
> >         mark->di = ip_vs_wrr_gcd_weight(svc);
> >         return 0;
> 
> Hi, 
> 
> sorry for being slow here. Yes that does seem to be a bug.  Yes, I think
> your fix is correct. Especiall when you compare what you now have in
> ip_vs_wrr_update_svc as opposed to what is alredy in ip_vs_wrr_init_svc.
> 
> I will post a patch that tires to merge that shortly - actually I have
> the patch, but I am waiting for it to build and want to check other
> schedulers too.

Hi, here is my patch for this problem, that has ip_vs_wrr_init_svc()
use ip_vs_wrr_update_svc() to avoid some minor code and functionalitly
duplication.

-- 
Horms

===== net/ipv4/ipvs/ip_vs_wrr.c 1.5 vs edited =====
--- 1.5/net/ipv4/ipvs/ip_vs_wrr.c       2004-02-19 06:03:53 +09:00
+++ edited/net/ipv4/ipvs/ip_vs_wrr.c    2005-02-04 12:55:33 +09:00
@@ -25,6 +25,8 @@
 
 #include <net/ip_vs.h>
 
+static int ip_vs_wrr_update_svc(struct ip_vs_service *svc);
+
 /*
  * current destination pointer for weighted round-robin scheduling
  */
@@ -98,11 +100,8 @@ static int ip_vs_wrr_init_svc(struct ip_
                IP_VS_ERR("ip_vs_wrr_init_svc(): no memory\n");
                return -ENOMEM;
        }
-       mark->cl = &svc->destinations;
-       mark->cw = 0;
-       mark->mw = ip_vs_wrr_max_weight(svc);
-       mark->di = ip_vs_wrr_gcd_weight(svc);
        svc->sched_data = mark;
+       ip_vs_wrr_update_svc(svc);
 
        return 0;
 }
@@ -124,6 +123,7 @@ static int ip_vs_wrr_update_svc(struct i
        struct ip_vs_wrr_mark *mark = svc->sched_data;
 
        mark->cl = &svc->destinations;
+       mark->cw = 0;
        mark->mw = ip_vs_wrr_max_weight(svc);
        mark->di = ip_vs_wrr_gcd_weight(svc);
        return 0;

<Prev in Thread] Current Thread [Next in Thread>