Commit df3839f9 authored by Duan Jiong's avatar Duan Jiong Committed by Jiri Slaby

neigh: recompute reachabletime before returning from neigh_periodic_work()

[ Upstream commit feff9ab2 ]

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: default avatarDuan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 10bbbd58
...@@ -764,9 +764,6 @@ static void neigh_periodic_work(struct work_struct *work) ...@@ -764,9 +764,6 @@ static void neigh_periodic_work(struct work_struct *work)
nht = rcu_dereference_protected(tbl->nht, nht = rcu_dereference_protected(tbl->nht,
lockdep_is_held(&tbl->lock)); lockdep_is_held(&tbl->lock));
if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
goto out;
/* /*
* periodically recompute ReachableTime from random function * periodically recompute ReachableTime from random function
*/ */
...@@ -779,6 +776,9 @@ static void neigh_periodic_work(struct work_struct *work) ...@@ -779,6 +776,9 @@ static void neigh_periodic_work(struct work_struct *work)
neigh_rand_reach_time(p->base_reachable_time); neigh_rand_reach_time(p->base_reachable_time);
} }
if (atomic_read(&tbl->entries) < tbl->gc_thresh1)
goto out;
for (i = 0 ; i < (1 << nht->hash_shift); i++) { for (i = 0 ; i < (1 << nht->hash_shift); i++) {
np = &nht->hash_buckets[i]; np = &nht->hash_buckets[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment