diff mbox

[net-next,03/12] ipvs: prefer NETDEV_DOWN event to free cached dsts

Message ID 1362559342-18784-4-git-send-email-ja@ssi.bg
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Julian Anastasov March 6, 2013, 8:42 a.m. UTC
The real server becomes unreachable on down event,
no need to wait device unregistration. Should help in
releasing dsts early before dst->dev is replaced with lo.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
 net/netfilter/ipvs/ip_vs_ctl.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Comments

Hans Schillstrom March 6, 2013, 9:56 a.m. UTC | #1
Hi Julian

On Wed, 2013-03-06 at 10:42 +0200, Julian Anastasov wrote:
> 	The real server becomes unreachable on down event,
> no need to wait device unregistration. Should help in
> releasing dsts early before dst->dev is replaced with lo.

Have you test this in a network namespace ?
i.e. kill the namespace with heave traffic through it

From what I remember this was a tricky area...

I have some test cases for this, should I run them ?


> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> ---
>  net/netfilter/ipvs/ip_vs_ctl.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index c68198b..76fc8f2 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -1512,10 +1512,8 @@ __ip_vs_dev_reset(struct ip_vs_dest *dest, struct net_device *dev)
>  	spin_unlock_bh(&dest->dst_lock);
>  
>  }
> -/*
> - * Netdev event receiver
> - * Currently only NETDEV_UNREGISTER is handled, i.e. if we hold a reference to
> - * a device that is "unregister" it must be released.
> +/* Netdev event receiver
> + * Currently only NETDEV_DOWN is handled to release refs to cached dsts
>   */
>  static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
>  			    void *ptr)
> @@ -1527,7 +1525,7 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
>  	struct ip_vs_dest *dest;
>  	unsigned int idx;
>  
> -	if (event != NETDEV_UNREGISTER || !ipvs)
> +	if (event != NETDEV_DOWN || !ipvs)
>  		return NOTIFY_DONE;
>  	IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
>  	EnterFunction(2);


Regards
Hans
Julian Anastasov March 6, 2013, 9:21 p.m. UTC | #2
Hello,

On Wed, 6 Mar 2013, Hans Schillstrom wrote:

> Hi Julian
> 
> On Wed, 2013-03-06 at 10:42 +0200, Julian Anastasov wrote:
> > 	The real server becomes unreachable on down event,
> > no need to wait device unregistration. Should help in
> > releasing dsts early before dst->dev is replaced with lo.
> 
> Have you test this in a network namespace ?
> i.e. kill the namespace with heave traffic through it

	This should not be a problem. Even without ns exit
situation, we can have a case where device goes down,
the output routes will start to fail and we will
not cache route anymore. It can happen while the
input device floods us with requests.

> From what I remember this was a tricky area...
> 
> I have some test cases for this, should I run them ?

	If it is easy...

> > Signed-off-by: Julian Anastasov <ja@ssi.bg>
> > ---
> >  net/netfilter/ipvs/ip_vs_ctl.c |    8 +++-----
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> > index c68198b..76fc8f2 100644
> > --- a/net/netfilter/ipvs/ip_vs_ctl.c
> > +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> > @@ -1512,10 +1512,8 @@ __ip_vs_dev_reset(struct ip_vs_dest *dest, struct net_device *dev)
> >  	spin_unlock_bh(&dest->dst_lock);
> >  
> >  }
> > -/*
> > - * Netdev event receiver
> > - * Currently only NETDEV_UNREGISTER is handled, i.e. if we hold a reference to
> > - * a device that is "unregister" it must be released.
> > +/* Netdev event receiver
> > + * Currently only NETDEV_DOWN is handled to release refs to cached dsts
> >   */
> >  static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
> >  			    void *ptr)
> > @@ -1527,7 +1525,7 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
> >  	struct ip_vs_dest *dest;
> >  	unsigned int idx;
> >  
> > -	if (event != NETDEV_UNREGISTER || !ipvs)
> > +	if (event != NETDEV_DOWN || !ipvs)
> >  		return NOTIFY_DONE;
> >  	IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
> >  	EnterFunction(2);
> 
> 
> Regards
> Hans

Regards

--
Julian Anastasov <ja@ssi.bg>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hans Schillstrom March 7, 2013, 7:43 a.m. UTC | #3
Hello
On Wed, 2013-03-06 at 23:21 +0200, Julian Anastasov wrote:
> 	Hello,
> 
> On Wed, 6 Mar 2013, Hans Schillstrom wrote:
> 
> > Hi Julian
> > 
> > On Wed, 2013-03-06 at 10:42 +0200, Julian Anastasov wrote:
> > > 	The real server becomes unreachable on down event,
> > > no need to wait device unregistration. Should help in
> > > releasing dsts early before dst->dev is replaced with lo.
> > 
> > Have you test this in a network namespace ?
> > i.e. kill the namespace with heave traffic through it
> 
> 	This should not be a problem. Even without ns exit
> situation, we can have a case where device goes down,
> the output routes will start to fail and we will
> not cache route anymore. It can happen while the
> input device floods us with requests.

I've gone through the unregister code a couple of times now
and in theory it should work. 
The test suit have also been running without problem 


> > From what I remember this was a tricky area...
> > 
> > I have some test cases for this, should I run them ?
> 
> 	If it is easy...
> 
> > > Signed-off-by: Julian Anastasov <ja@ssi.bg>

Signed-off by: Hans Schillstrom <hans@schillstrom.com>

> > > ---
> > >  net/netfilter/ipvs/ip_vs_ctl.c |    8 +++-----
> > >  1 files changed, 3 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> > > index c68198b..76fc8f2 100644
> > > --- a/net/netfilter/ipvs/ip_vs_ctl.c
> > > +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> > > @@ -1512,10 +1512,8 @@ __ip_vs_dev_reset(struct ip_vs_dest *dest, struct net_device *dev)
> > >  	spin_unlock_bh(&dest->dst_lock);
> > >  
> > >  }
> > > -/*
> > > - * Netdev event receiver
> > > - * Currently only NETDEV_UNREGISTER is handled, i.e. if we hold a reference to
> > > - * a device that is "unregister" it must be released.
> > > +/* Netdev event receiver
> > > + * Currently only NETDEV_DOWN is handled to release refs to cached dsts
> > >   */
> > >  static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
> > >  			    void *ptr)
> > > @@ -1527,7 +1525,7 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
> > >  	struct ip_vs_dest *dest;
> > >  	unsigned int idx;
> > >  
> > > -	if (event != NETDEV_UNREGISTER || !ipvs)
> > > +	if (event != NETDEV_DOWN || !ipvs)
> > >  		return NOTIFY_DONE;
> > >  	IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
> > >  	EnterFunction(2);
> > 
> > 
> > Regards
> > Hans
> 
> Regards
> 
> --
> Julian Anastasov <ja@ssi.bg>

Regargs
Hans
diff mbox

Patch

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index c68198b..76fc8f2 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1512,10 +1512,8 @@  __ip_vs_dev_reset(struct ip_vs_dest *dest, struct net_device *dev)
 	spin_unlock_bh(&dest->dst_lock);
 
 }
-/*
- * Netdev event receiver
- * Currently only NETDEV_UNREGISTER is handled, i.e. if we hold a reference to
- * a device that is "unregister" it must be released.
+/* Netdev event receiver
+ * Currently only NETDEV_DOWN is handled to release refs to cached dsts
  */
 static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
 			    void *ptr)
@@ -1527,7 +1525,7 @@  static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
 	struct ip_vs_dest *dest;
 	unsigned int idx;
 
-	if (event != NETDEV_UNREGISTER || !ipvs)
+	if (event != NETDEV_DOWN || !ipvs)
 		return NOTIFY_DONE;
 	IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
 	EnterFunction(2);