All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] neigh: recompute reachabletime before returning from neigh_periodic_work()
@ 2014-02-27  9:14 Duan Jiong
  2014-02-27 23:22 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Duan Jiong @ 2014-02-27  9:14 UTC (permalink / raw)
  To: David Miller; +Cc: netdev


If the neigh table's entries is less than gc_thresh1, the function
will return directly, and the reachabletime will not be recompute,
so the reachabletime can be guessed.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/core/neighbour.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 026bfd1..7c62a34 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -766,9 +766,6 @@ static void neigh_periodic_work(struct work_struct *work)
 	nht = rcu_dereference_protected(tbl->nht,
 					lockdep_is_held(&tbl->lock));
 
-	if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
-		goto out;
-
 	/*
 	 *	periodically recompute ReachableTime from random function
 	 */
@@ -781,6 +778,9 @@ static void neigh_periodic_work(struct work_struct *work)
 				neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
 	}
 
+	if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
+		goto out;
+
 	for (i = 0 ; i < (1 << nht->hash_shift); i++) {
 		np = &nht->hash_buckets[i];
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] neigh: recompute reachabletime before returning from neigh_periodic_work()
  2014-02-27  9:14 [PATCH] neigh: recompute reachabletime before returning from neigh_periodic_work() Duan Jiong
@ 2014-02-27 23:22 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-02-27 23:22 UTC (permalink / raw)
  To: duanj.fnst; +Cc: netdev

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Thu, 27 Feb 2014 17:14:41 +0800

> If the neigh table's entries is less than gc_thresh1, the function
> will return directly, and the reachabletime will not be recompute,
> so the reachabletime can be guessed.
> 
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>

It looks like this bug was unintentionally introduced by:

commit 2724680bceee94eac391552863771af105a7355c
Author: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date:   Tue Jan 22 05:20:05 2013 +0000

    neigh: Keep neighbour cache entries if number of them is small enough.

Applied and queued up for -stable, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-27 23:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27  9:14 [PATCH] neigh: recompute reachabletime before returning from neigh_periodic_work() Duan Jiong
2014-02-27 23:22 ` David Miller

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.