From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: [PATCH RFC batadv v4 7/8] batman-adv: tt: don't uncount never committed clients on pending purge
Date: Thu, 06 Aug 2026 09:41:32 +0200 [thread overview]
Message-ID: <20260806-tt-fixes-v4-7-c2fc871fe807@narfation.org> (raw)
In-Reply-To: <20260806-tt-fixes-v4-0-c2fc871fe807@narfation.org>
batadv_tt_local_purge_pending_clients() decreases vlan->tt.num_entries for
every entry it unlinks, but an entry which still carries
BATADV_TT_CLIENT_NEW was never counted by batadv_tt_local_transition_new().
batadv_tt_local_resize_to_mtu() calls batadv_tt_local_purge() and
batadv_tt_local_purge_pending_clients() directly, without committing in
between, and it halves its timeout down towards zero. Once the timeout is
short enough, batadv_tt_local_purge_list() marks even freshly added clients
as pending. And each of them decreases a counter it never increased.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
net/batman-adv/translation-table.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index fcdccd52..b8aff4ec 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -398,6 +398,10 @@ static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv,
* given vid
* @bat_priv: the bat priv with all the mesh interface information
* @vid: the VLAN identifier
+ *
+ * It must only be called after a batadv_tt_local_entry without NEW flag
+ * was removed from bat_priv->tt.local_hash (under under the specific
+ * list_locks[i]).
*/
static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv,
unsigned short vid)
@@ -4071,8 +4075,13 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
tt_common->addr,
batadv_print_vid(tt_common->vid));
- batadv_tt_local_size_dec(bat_priv, tt_common->vid);
hlist_del_rcu(&tt_common->hash_entry);
+
+ /* An entry which still carries BATADV_TT_CLIENT_NEW was
+ * never counted and must not be uncounted here.
+ */
+ if (!(tt_common->flags & BATADV_TT_CLIENT_NEW))
+ batadv_tt_local_size_dec(bat_priv, tt_common->vid);
}
if (cont)
--
2.47.3
next prev parent reply other threads:[~2026-08-06 7:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 7:41 [PATCH RFC batadv v4 0/8] batman-adv: tt: atomic sashiko fixes Sven Eckelmann
2026-08-06 7:41 ` [PATCH RFC batadv v4 1/8] batman-adv: tt: remove only the entry which was looked up from the hash Sven Eckelmann
2026-08-06 7:41 ` [PATCH RFC batadv v4 2/8] batman-adv: tt: extract code handling a roam on add Sven Eckelmann
2026-08-06 7:41 ` [PATCH RFC batadv v4 3/8] batman-adv: tt: simplify NEW flag transition code Sven Eckelmann
2026-08-06 7:41 ` [PATCH RFC batadv v4 4/8] batman-adv: tt: drop unnecessary cleanup goto in helpers Sven Eckelmann
2026-08-06 7:41 ` [PATCH RFC batadv v4 5/8] batman-adv: tt: use protected flag modifications Sven Eckelmann
2026-08-06 7:41 ` [PATCH RFC batadv v4 6/8] batman-adv: tt: transition NEW local entries only under lock Sven Eckelmann
2026-08-06 7:41 ` Sven Eckelmann [this message]
2026-08-06 7:41 ` [PATCH RFC batadv v4 8/8] batman-adv: tt: decrement count for committed client on local_remove Sven Eckelmann
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=20260806-tt-fixes-v4-7-c2fc871fe807@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox