From: Tinggong Wang <wangtinggong@gmail.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: Wensong Zhang <wensong@linux-vs.org>,
Simon Horman <horms@verge.net.au>,
lvs-devel@vger.kernel.org
Subject: Re: [PATCH 3/3] ipvs: fix get_curr_sync_buff
Date: Tue, 14 Dec 2010 11:00:26 +0800 [thread overview]
Message-ID: <20101214030026.GA3399@wangtg> (raw)
In-Reply-To: <alpine.LFD.2.00.1012140113140.2634@ja.ssi.bg>
on Tue, 14 Dec 2010 01:32:36AM +0200 Julian Anastasov (ja@ssi.bg) wrote:
>
> Hello,
>
> On Sun, 12 Dec 2010, Tinggong Wang wrote:
>
> >use time_after get the current buffer created more than the specified time.
> >
> >time_before in get_curr_sync_buff(2 * HZ) will get the buffer created newly.
> >if curr_sb has been created more than 2*HZ then it will still sit in master.
> >so use time_after instead.
> >
> >Signed-off-by: Tinggong Wang <wangtinggong@gmail.com>
> >---
> >net/netfilter/ipvs/ip_vs_sync.c | 3 +--
> >1 files changed, 1 insertions(+), 2 deletions(-)
> >
> >diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
> >index 2b6b0cb..555b0dd 100644
> >--- a/net/netfilter/ipvs/ip_vs_sync.c
> >+++ b/net/netfilter/ipvs/ip_vs_sync.c
> >@@ -221,8 +221,7 @@ get_curr_sync_buff(unsigned long time)
> > struct ip_vs_sync_buff *sb;
> >
> > spin_lock_bh(&curr_sb_lock);
> >- if (curr_sb && (time == 0 ||
> >- time_before(jiffies - curr_sb->firstuse, time))) {
> >+ if (curr_sb && time_after(jiffies - curr_sb->firstuse, time)) {
>
> This breaks the time=0 case when jiffies matches firstuse.
>
> May be the fix should be as follows?:
>
> if (curr_sb && time_after_eq(jiffies - curr_sb->firstuse, time)) {
>
> i.e. passed >= limit (2 or 0).
>
Thanks!
here is the improved patch:
From 68f30a4e8759dae7de4fb846db8ad264301c0bc6 Mon Sep 17 00:00:00 2001
From: Tinggong Wang <wangtinggong@gmail.com>
Date: Tue, 14 Dec 2010 10:53:24 +0800
Subject: [PATCH] ipvs: fix get_curr_sync_buff
use time_after_eq get the current buffer created more than the specified time,
or equals it.
Signed-off-by: Tinggong Wang <wangtinggong@gmail.com>
---
net/netfilter/ipvs/ip_vs_sync.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index c1c167a..e9d2196 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -395,8 +395,7 @@ get_curr_sync_buff(unsigned long time)
struct ip_vs_sync_buff *sb;
spin_lock_bh(&curr_sb_lock);
- if (curr_sb && (time == 0 ||
- time_before(jiffies - curr_sb->firstuse, time))) {
+ if (curr_sb && time_after_eq(jiffies - curr_sb->firstuse, time)) {
sb = curr_sb;
curr_sb = NULL;
} else
--
1.7.2.3
> > sb = curr_sb;
> > curr_sb = NULL;
> > } else
> >--
> >1.7.2.3
>
> Regards
>
> --
> Julian Anastasov <ja@ssi.bg>
next prev parent reply other threads:[~2010-12-14 3:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-12 11:41 [PATCH 1/3] ipvs: use SYNC_MESG_HEADER_LEN instead of explicit header length Tinggong Wang
2010-12-12 11:42 ` [PATCH 2/3] ipvs: check data validation before local_bh_disable Tinggong Wang
2010-12-12 11:43 ` [PATCH 3/3] ipvs: fix get_curr_sync_buff Tinggong Wang
2010-12-12 21:49 ` Simon Horman
2010-12-13 9:21 ` Hans Schillstrom
2010-12-13 23:32 ` Julian Anastasov
2010-12-14 3:00 ` Tinggong Wang [this message]
2010-12-14 8:28 ` Julian Anastasov
2010-12-15 8:28 ` Simon Horman
2010-12-12 21:48 ` [PATCH 2/3] ipvs: check data validation before local_bh_disable Simon Horman
2010-12-13 3:44 ` Tinggong Wang
2010-12-13 6:29 ` Simon Horman
2010-12-13 8:53 ` Hans Schillstrom
2010-12-13 10:49 ` Tinggong Wang
2010-12-13 18:06 ` Tinggong Wang
2010-12-12 21:46 ` [PATCH 1/3] ipvs: use SYNC_MESG_HEADER_LEN instead of explicit header length Simon Horman
2010-12-13 8:16 ` Hans Schillstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101214030026.GA3399@wangtg \
--to=wangtinggong@gmail.com \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=lvs-devel@vger.kernel.org \
--cc=wensong@linux-vs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.