Skip to content

Commit

Permalink
neigh: recompute reachabletime before returning from neigh_periodic_w…
Browse files Browse the repository at this point in the history
…ork()

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Duan Jiong authored and David S. Miller committed Feb 27, 2014
1 parent 352063c commit feff9ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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];

Expand Down

0 comments on commit feff9ab

Please sign in to comment.