From: David Ahern <dsahern@kernel.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, roopa@cumulusnetworks.com,
David Ahern <dsahern@gmail.com>
Subject: [PATCH net-next 2/5] neighbor: Fix state check in neigh_forced_gc
Date: Tue, 11 Dec 2018 18:57:22 -0700 [thread overview]
Message-ID: <20181212015725.12297-3-dsahern@kernel.org> (raw)
In-Reply-To: <20181212015725.12297-1-dsahern@kernel.org>
From: David Ahern <dsahern@gmail.com>
PERMANENT entries are not on the gc_list so the state check is now
redundant. Also, the move to not purge entries until after 5 seconds
should not apply to FAILED entries; those can be removed immediately
to make way for newer ones. This restores the previous logic prior to
the gc_list.
Fixes: 58956317c8de ("neighbor: Improve garbage collection")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/core/neighbour.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 010784123bc1..acaa1a64150d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -204,7 +204,6 @@ static int neigh_forced_gc(struct neigh_table *tbl)
unsigned long tref = jiffies - 5 * HZ;
u8 flags = NTF_EXT_LEARNED;
struct neighbour *n, *tmp;
- u8 state = NUD_PERMANENT;
int shrunk = 0;
NEIGH_CACHE_STAT_INC(tbl, forced_gc_runs);
@@ -216,8 +215,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
bool remove = false;
write_lock(&n->lock);
- if (!(n->nud_state & state) && !(n->flags & flags) &&
- time_after(tref, n->updated))
+ if ((n->nud_state == NUD_FAILED) ||
+ (!(n->flags & flags) && time_after(tref, n->updated)))
remove = true;
write_unlock(&n->lock);
--
2.11.0
next prev parent reply other threads:[~2018-12-12 1:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 1:57 [PATCH net-next 0/5] neighbor: More gc_list changes David Ahern
2018-12-12 1:57 ` [PATCH net-next 1/5] neighbor: Fix locking order for " David Ahern
2018-12-12 1:57 ` David Ahern [this message]
2018-12-12 1:57 ` [PATCH net-next 3/5] neighbor: Remove state and flags arguments to neigh_del David Ahern
2018-12-12 1:57 ` [PATCH net-next 4/5] neighbor: Move neigh_update_ext_learned to core file David Ahern
2018-12-12 1:57 ` [PATCH net-next 5/5] neighbor: Remove externally learned entries from gc_list David Ahern
2018-12-14 23:45 ` [PATCH net-next 0/5] neighbor: More gc_list changes David Miller
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=20181212015725.12297-3-dsahern@kernel.org \
--to=dsahern@kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
/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.