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 batadv v2 5/6] batman-adv: tt: decrement count for committed client on local_remove
Date: Tue, 04 Aug 2026 12:18:16 +0200 [thread overview]
Message-ID: <20260804-tt-fixes-v2-5-487c48fc7fc4@narfation.org> (raw)
In-Reply-To: <20260804-tt-fixes-v2-0-487c48fc7fc4@narfation.org>
Local TT entries which have the BATADV_TT_CLIENT_NEW no longer set are
committed. The batadv_tt_local_size_inc() was called for them and thus the
batadv_tt_local_size_dec() has to be called also when
batadv_tt_local_remove() is called for them when the BATADV_TT_CLIENT_NEW
wasn't consumed in the remove path.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
net/batman-adv/translation-table.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index cf13ea2f..28575051 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1418,6 +1418,7 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
struct batadv_tt_local_entry *tt_local_entry;
struct hlist_node *tt_removed_node;
u16 curr_flags = BATADV_NO_FLAGS;
+ u16 old_flags;
u16 flags;
tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
@@ -1463,6 +1464,15 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
if (!tt_removed_node)
goto out;
+ /* batadv_tt_local_transition_new() may have committed the entry and
+ * thus counted it in the local table size since the BATADV_TT_CLIENT_NEW
+ * check above.
+ */
+ old_flags = atomic_fetch_andnot(BATADV_TT_CLIENT_NEW,
+ &tt_local_entry->common.flags);
+ if (!(old_flags & BATADV_TT_CLIENT_NEW))
+ batadv_tt_local_size_dec(bat_priv, tt_local_entry->common.vid);
+
/* drop reference of remove hash entry */
batadv_tt_local_entry_put(tt_local_entry);
--
2.47.3
next prev parent reply other threads:[~2026-08-04 10:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 10:18 [PATCH batadv v2 0/6] batman-adv: tt: atomic_t sashiko fixes Sven Eckelmann
2026-08-04 10:18 ` [PATCH batadv v2 1/6] batman-adv: tt: remove only the entry which was looked up from the hash Sven Eckelmann
2026-08-04 10:18 ` [PATCH batadv v2 2/6] batman-adv: tt: extract code handling a roam on add Sven Eckelmann
2026-08-04 10:18 ` [PATCH batadv v2 3/6] batman-adv: tt: simplify NEW flag transition code Sven Eckelmann
2026-08-04 10:18 ` [PATCH batadv v2 4/6] batman-adv: tt: use atomic flag modifications Sven Eckelmann
2026-08-04 10:18 ` Sven Eckelmann [this message]
2026-08-04 10:18 ` [PATCH batadv v2 6/6] batman-adv: tt: don't uncount never committed clients on pending purge 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=20260804-tt-fixes-v2-5-487c48fc7fc4@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