From: netdev-bot+sashiko@kernel.org
To: sw@simonwunderlich.de
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
b.a.t.m.a.n@lists.open-mesh.org, sven@narfation.org
Subject: Re: [PATCH net-next 11/15] batman-adv: tt: requeue DEL of pending local entry after failed allocation
Date: Tue, 24 Nov 2026 17:20:44 +0000 [thread overview]
Message-ID: <179554084450.3135.11910035656981995724@kernel.org> (raw)
In-Reply-To: <20261123171827.3294525-12-sw@simonwunderlich.de>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] A failed DEL|ROAM for a local entry that is already
BATADV_TT_CLIENT_PENDING is never retried, and the new kernel-doc says…
- [Low] The concern: the patch has no Fixes: tag and does not say that it
depends on the preceding commit "batman-adv: tt: keep local entry…
Pre-existing issues:
- [Low] The concern: the periodic batadv_tt_local_purge_list() requeue
runs without tt.commit_lock and can clear del_unqueued after…
--
batman-adv: tt: requeue DEL of pending local entry after failed allocation
Sometimes batadv_tt_local_set_pending() cannot queue the DEL for a local
entry because the change allocation failed. This patch marks such an
entry as del_unqueued. batadv_tt_local_purge_list() then retries the
DEL, and batadv_tt_local_purge_pending_clients() keeps the entry in the
local table until the DEL is queued. batadv_tt_local_refresh_locked()
clears the mark when the client is added again.
> diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> index c94b292a1c4a8..0c5e21f3ba756 100644
> --- a/net/batman-adv/translation-table.c
> +++ b/net/batman-adv/translation-table.c
[ ... ]
> @@ -1779,13 +1793,24 @@ batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
> {
> struct batadv_tt_common_entry *common = &tt_local_entry->common;
> struct batadv_hashtable *hash = bat_priv->tt.local_hash;
> + bool queued;
> u32 i;
>
> i = batadv_choose_tt(&common->key, hash->size);
> lockdep_assert_held(&hash->list_locks[i]);
> lockdep_assert_held(&common->flags_lock);
>
> - __batadv_tt_local_event(bat_priv, common, common->flags | flags);
> + queued = __batadv_tt_local_event(bat_priv, common,
> + common->flags | flags);
[Severity: Low]
This isn't a bug, but this code now relies on __batadv_tt_local_event()
returning bool. That return value was added by the preceding patch,
"batman-adv: tt: keep local entry unchanged when ADD can't be queued".
The commit message doesn't mention this dependency, and there is no
Fixes: tag. No patch in the series has a Fixes: tag, so this may be
intentional. Is the series meant to stay out of stable?
> +
> + /* a failed attempt must not hide the still queued DEL of an already
> + * pending entry
> + */
> + if (queued)
> + tt_local_entry->del_unqueued = false;
> + else if (!(common->flags & BATADV_TT_CLIENT_PENDING))
> + tt_local_entry->del_unqueued = true;
[Severity: Low]
What happens here when the entry is already BATADV_TT_CLIENT_PENDING and
the new event carries BATADV_TT_CLIENT_ROAM?
batadv_tt_local_remove_entry() doesn't check for PENDING. With roaming
set, it does this:
if (roaming)
common->flags |= BATADV_TT_CLIENT_ROAM;
flags = BATADV_TT_CLIENT_DEL;
if (roaming)
flags |= BATADV_TT_CLIENT_ROAM;
batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags,
message);
A remote node can reach this path:
batadv_handle_roam_adv()
batadv_tt_global_add(..., BATADV_TT_CLIENT_ROAM)
batadv_tt_global_purge_local()
batadv_tt_local_remove(..., roaming=true)
batadv_tt_local_set_pending(DEL | ROAM)
Say a plain DEL was already queued earlier in the same OGM interval, for
example by the timeout in batadv_tt_local_purge_list(). The DEL+DEL
update can still fail, because __batadv_tt_local_event() allocates
before it looks for the queued change to merge into:
tt_change_node = kmem_cache_alloc(batadv_tt_change_cache, GFP_ATOMIC);
if (!tt_change_node)
return false;
In that case the else-if above leaves del_unqueued false. So
batadv_tt_local_purge_list() never requeues the DEL with the ROAM flag.
Only the plain DEL is announced. Receivers then call
batadv_tt_global_del() with roaming=false. That removes the old
originator right away instead of going through
batadv_tt_global_del_roaming().
Could unicast traffic to the client be lost until the ADD from the new
originator arrives?
The kernel-doc this patch adds to __batadv_tt_local_event() says:
The only exception is the DEL of batadv_tt_local_set_pending(). Its
entry is marked as del_unqueued to get the DEL requeued by
batadv_tt_local_purge_list().
The new batadv_tt_local_set_pending() kernel-doc says the same: "Such an
entry is marked as del_unqueued instead". Neither seems to hold for this
case.
The lost ROAM upgrade was already possible before this series. The
kernel-doc claiming this case is covered is new, though, and this part
looks the same at the end of the series.
Could __batadv_tt_local_event() look up the existing change before
allocating, so the in-place update can't fail? If not, the kernel-doc
could say that an already pending entry only keeps its first DEL.
> +
> common->flags |= BATADV_TT_CLIENT_PENDING;
[ ... ]
> @@ -1911,11 +1936,18 @@ static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv,
> common);
>
> scoped_guard(spinlock_bh, &tt_local_entry->common.flags_lock) {
> - if (tt_local_entry->common.flags & BATADV_TT_CLIENT_NOPURGE)
> + /* entry already marked for deletion */
> + if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING) {
> + /* but its removal must still be announced */
> + if (tt_local_entry->del_unqueued)
> + batadv_tt_local_set_pending(bat_priv,
> + tt_local_entry,
> + BATADV_TT_CLIENT_DEL,
> + "requeued");
[Severity: Low]
This is a pre-existing issue and wasn't introduced by this patch. This
requeue runs from the periodic work without tt.commit_lock.
Can it clear del_unqueued after the splice but before
batadv_tt_local_purge_pending_clients() runs in
batadv_tt_local_commit_changes_nolock()?
spin_lock_bh(&bat_priv->tt.changes_list_lock);
list_splice_init(&bat_priv->tt.changes_list, &changes_list);
...
batadv_tt_local_transition_new(bat_priv);
batadv_tt_local_purge_pending_clients(bat_priv);
If so, the entry is removed in the current TTVN, but its DEL is only
announced in the next one. The same window already existed for any
concurrent batadv_tt_local_set_pending() DEL. The worst case looks like
a CRC mismatch for one TTVN, which a full table request repairs.
A later patch in this series, "batman-adv: tt: commit only the announced
local changes", seems to close this. After it, only entries whose DEL is
in the spliced changes_list are unhashed. The only remaining caller of
batadv_tt_local_purge_pending_clients() is
batadv_tt_local_resize_to_mtu(), which runs under commit_lock before the
splice.
> break;
> + }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123171827.3294525-2-sw%40simonwunderlich.de
next prev parent reply other threads:[~2026-11-24 17:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 17:18 [PATCH net-next 00/15] pull request for net-next: batman-adv 2026-11-23 Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 01/15] batman-adv: document refcount of returned objects Simon Wunderlich
2026-11-23 17:23 ` netdev-bot+sinfo
2026-11-23 18:13 ` Sven Eckelmann
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-23 17:18 ` [PATCH net-next 02/15] batman-adv: mcast: use mla_lock also during mcast_free Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 03/15] batman-adv: mark functions inheriting critical sections Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 04/15] batman-adv: bla: register own backbone gw when claiming for local node Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-24 19:19 ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 05/15] batman-adv: tt: unhash local entries with hlist_del_init_rcu() Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 06/15] batman-adv: tt: refresh local entry in single flags_lock section Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-24 19:22 ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 07/15] batman-adv: tt: don't remove unhashed local entries Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-24 19:24 ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 08/15] batman-adv: tt: don't queue local events for unhashed entries Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 09/15] batman-adv: tt: remove unannounced local entries via pending state Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 10/15] batman-adv: tt: keep local entry unchanged when ADD can't be queued Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-24 19:30 ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 11/15] batman-adv: tt: requeue DEL of pending local entry after failed allocation Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko [this message]
2026-11-24 19:46 ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 12/15] batman-adv: tt: extract removal of pending local entry Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-24 20:16 ` Sven Eckelmann
2026-11-23 17:18 ` [PATCH net-next 13/15] batman-adv: tt: commit only the announced local changes Simon Wunderlich
2026-11-24 17:20 ` netdev-bot+sashiko
2026-11-23 17:18 ` [PATCH net-next 14/15] batman-adv: tt: avoid list_lock for unchanged local clients Simon Wunderlich
2026-11-23 17:18 ` [PATCH net-next 15/15] batman-adv: tt: drop ADD+DEL events of never announced clients Simon Wunderlich
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=179554084450.3135.11910035656981995724@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sven@narfation.org \
--cc=sw@simonwunderlich.de \
/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