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] In net/tipc/node.c, the call to tipc_node_lxc_xmit() inside the
new tipc_node_distribute() (line 1847) can never do anything, so it is…
- [Low] tipc_named_node_up() (net/tipc/name_distr.c, around lines
227-231) maps -ELINKCONG to 0, with the comment "The link is congested…
--
tipc: fix self-deadlock in tipc_named_node_up
This patch removes cluster_scope_lock and uses nametbl_lock to protect
the cluster_scope list. That avoids a self-deadlock when
tipc_node_xmit() reaches tipc_node_link_down() while the read lock is
held. It also adds tipc_node_distribute(), which sends the bulk list
without calling tipc_node_link_down(), and moves the link reset on
-ENOBUFS into tipc_node_write_unlock().
quoted hunk ↗ jump to hunk
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 1fe650a95eb42..2e07d50a29437 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -202,25 +198,39 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
[ ... ]
quoted hunk ↗ jump to hunk
-void tipc_named_node_up(struct net *net, u32 dnode, u16 capabilities)
+int tipc_named_node_up(struct net *net, u32 dnode,
+ u16 capabilities, int *bearer_id)
{
[ ... ]
quoted hunk ↗ jump to hunk
__skb_queue_head_init(&head);
spin_lock_bh(&tn->nametbl_lock);
if (!(capabilities & TIPC_NAMED_BCAST))
nt->rc_dests++;
- seqno = nt->snd_nxt;
+ named_distribute(net, &head, dnode, &nt->cluster_scope, nt->snd_nxt);
+ if (!skb_queue_empty(&head))
+ rc = tipc_node_distribute(net, &head, dnode, bearer_id, 0);
spin_unlock_bh(&tn->nametbl_lock);
- read_lock_bh(&nt->cluster_scope_lock);
- named_distribute(net, &head, dnode, &nt->cluster_scope, seqno);
- tipc_node_xmit(net, &head, dnode, 0);
- read_unlock_bh(&nt->cluster_scope_lock);
+ /* The link is congested after the list is inserted into
+ * the link's send queue. Return 0, as this is normal.
+ */
+ if (rc == -ELINKCONG)
+ rc = 0;
[Severity: Low]
Can tipc_link_xmit() return -ELINKCONG for this list?
Every buffer that named_distribute() builds has user NAME_DISTRIBUTOR.
msg_importance() maps that user to TIPC_SYSTEM_IMPORTANCE:
net/tipc/msg.h:msg_importance() {
if (likely((usr <= TIPC_CRITICAL_IMPORTANCE) && !msg_errcode(m)))
return usr;
if ((usr == MSG_FRAGMENTER) || (usr == MSG_BUNDLER))
return msg_bits(m, 9, 0, 0x7);
return TIPC_SYSTEM_IMPORTANCE;
}
In tipc_link_xmit(), a SYSTEM importance list that hits the backlog limit
is purged and gets -ENOBUFS. That means link_schedule_user(), the only
source of -ELINKCONG, is never called for it:
net/tipc/link.c:tipc_link_xmit() {
...
if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) {
if (imp == TIPC_SYSTEM_IMPORTANCE) {
pr_warn("%s<%s>, link overflow", link_rst_msg, l->name);
__skb_queue_purge(list);
return -ENOBUFS;
}
rc = link_schedule_user(l, hdr);
}
...
}
When transmq is full, the buffers just move to the backlog and rc stays
0.
If that's right, this branch is dead code. The comment also says
congestion is a normal result here, but for this traffic congestion ends
in -ENOBUFS and a link reset. The -ELINKCONG entry in the
tipc_node_distribute() kernel-doc has the same problem.
Later in the series, the same branch and comment are copied into
tipc_named_distribute().
quoted hunk ↗ jump to hunk
diff --git a/net/tipc/node.c b/net/tipc/node.c
index dfbeed21dbc1b..77979a850df24 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -1737,44 +1792,72 @@ int tipc_node_xmit(struct net *net, struct sk_buff_head *list,
[ ... ]
quoted hunk ↗ jump to hunk
+int tipc_node_distribute(struct net *net, struct sk_buff_head *list,
+ u32 dnode, int *bearer_id, int selector)
+{
+ struct tipc_media_addr maddr;
+ struct sk_buff_head xmitq;
+ struct tipc_node *n;
+ int rc;
+
+ n = tipc_node_find(net, dnode);
+ if (unlikely(!n)) {
__skb_queue_purge(list);
return -EHOSTUNREACH;
}
+ if (tipc_node_lxc_xmit(n, list)) {
+ tipc_node_put(n);
+ return 0;
+ }
[Severity: Low]
Can this tipc_node_lxc_xmit() call ever consume the list?
tipc_named_node_up() is the only caller of tipc_node_distribute(), and
it passes the bulk list from named_distribute(). named_prepare_buf()
builds each of those buffers with user NAME_DISTRIBUTOR:
net/tipc/name_distr.c:named_prepare_buf() {
...
tipc_msg_init(self, msg, NAME_DISTRIBUTOR,
type, INT_H_SIZE, dest);
...
}
For that user, tipc_lxc_xmit() returns without touching the list:
net/tipc/node.c:tipc_lxc_xmit() {
...
case LINK_PROTOCOL:
case NAME_DISTRIBUTOR:
case TUNNEL_PROTOCOL:
case BCAST_PROTOCOL:
return;
...
}
So skb_queue_empty(list) is always false and tipc_node_lxc_xmit() always
returns 0 here. All it adds is an extra rcu_read_lock() and a node read
lock round trip before tipc_node_build_list().
Runtime behavior doesn't change, because the old tipc_node_xmit() never
delivered named bulk messages over lxc either. This is still true at the
end of the series. The tipc_named_distribute() caller added later also
only passes named_distribute() output.
Could this call be dropped from tipc_node_distribute()? The commit
message says:
Both functions call the newly introduced tipc_node_build_list(),
which clones a list of messages in sequence and tipc_node_lxc_xmit()
which delivers the list to the peer namespace.
The v3 changelog also says "Introduce tipc_node_lxc_xmit() for container
communication", but tipc_node_distribute() never does that delivery.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116063529.6185-1-tung.quang.nguyen%40est.tech