🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Igor Opaniuk Sat, 14 Nov 2026 12:46
[PATCH net v2] net: qrtr: ns: keep notifying local servers after a failed send
#16268
Author: Igor Opaniuk
Date: Sat, 14 Nov 2026 12:46
107 lines
19577 bytes
ctrl_cmd_bye() and ctrl_cmd_del_client() forward the event to every
local server, but stop at the first failed send. Each send goes to a
different socket, so a single server with a full receive queue
(-ENOSPC) hides the event from all servers after it.

Log the failure and carry on. Likewise, keep notifying local lookups
when the NEW_SERVER broadcast fails, which can only happen on -ENOMEM.

Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace")
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
---
The lost-announcement problem v1 went after is fixed by commit
743b5c86276b ("net: qrtr: announce local services again once our HELLO
is sent"), so v1's patch 2 (holding control packets behind the HELLO) is
dropped, as Mani suggested. This is v1's patch 1, reworked after the
Sashiko review: it no longer touches announce_servers() (every
announcement there goes to the same node), and instead fixes the BYE and
DEL_CLIENT loops, which stop at the first local server that cannot take
the packet.

qrtr_bcast_enqueue() still ignores the per-node enqueue results and stops
at a failed pskb_copy() (Sashiko, pre-existing); not touched here.

Tested on the Arduino UNO Q (QRB2210) with next-20261112 plus the board
support it needs, with a test program that publishes a server whose
receive queue is full, and then a second one, on a higher port:
- unpatched: the second server gets neither the DEL_CLIENT of a closed
  client nor the BYE of the stopped modem ("failed to send del client
  cmd" / "failed to send bye cmd", -ENOSPC);
- patched: it gets both, and the name server logs the failed sends with
  their destination; modem stop/start, 3 boots and the board tests
  (WiFi through the modem, ADSP, Bluetooth) pass.
Built with W=1; checkpatch clean.

Changes in v2:
- Rebased on top of 743b5c86276b; v1's patch 2 dropped (Mani).
- announce_servers() left as is: carrying on there only repeated the
  same failure and could print up to 256 lines per HELLO (Sashiko).
- ctrl_cmd_bye() and ctrl_cmd_del_client() keep going after a failed
  send, rate-limited log with destination and error (Sashiko).
- Commit message: lookups are local observers only; the NEW_SERVER
  broadcast fails only before enqueue, in practice -ENOMEM (Sashiko).
- Fixes: points at the commit that added these loops; for net.
- Link to v1: https://lore.kernel.org/r/20261019-upstream-qrtr-hello-gate-fix_b4-v1-0-bd420aec171b@oss.qualcomm.com
---
 net/qrtr/ns.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index bcb090ee79d4..8209573221a5 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -374,11 +374,11 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from)
 		msg.msg_name = (struct sockaddr *)&sq;
 		msg.msg_namelen = sizeof(sq);
 
+		/* A server that cannot take it must not hide it from the rest */
 		ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
-		if (ret < 0 && ret != -ENODEV) {
-			pr_err("failed to send bye cmd\n");
-			goto delete_node;
-		}
+		if (ret < 0 && ret != -ENODEV)
+			pr_err_ratelimited("failed to send bye cmd to %u:%u: %d\n",
+					   srv->node, srv->port, ret);
 	}
 
 	/* Ignore -ENODEV */
@@ -458,11 +458,11 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,
 		msg.msg_name = (struct sockaddr *)&sq;
 		msg.msg_namelen = sizeof(sq);
 
+		/* A server that cannot take it must not hide it from the rest */
 		ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));
-		if (ret < 0 && ret != -ENODEV) {
-			pr_err("failed to send del client cmd\n");
-			return ret;
-		}
+		if (ret < 0 && ret != -ENODEV)
+			pr_err_ratelimited("failed to send del client cmd to %u:%u: %d\n",
+					   srv->node, srv->port, ret);
 	}
 	return 0;
 }
@@ -487,11 +487,10 @@ static int ctrl_cmd_new_server(struct sockaddr_qrtr *from,
 		return -EINVAL;
 
 	if (srv->node == qrtr_ns.local_node) {
+		/* The lookups below still need to hear about the server */
 		ret = service_announce_new(&qrtr_ns.bcast_sq, srv);
-		if (ret < 0) {
+		if (ret < 0)
 			pr_err("failed to announce new service\n");
-			return ret;
-		}
 	}
 
 	/* Notify any potential lookups about the new server */

---
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
change-id: 20261019-upstream-qrtr-hello-gate-fix_b4-c2e8c2f4f906

Best regards,
-- 
Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Re: [PATCH net v2] net: qrtr: ns: keep notifying local servers after a failed send
#20069
Author: patchwork-bot+netdevbpf
Date: Sat, 21 Nov 2026 02:00
25 lines
8780 bytes
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 14 Nov 2026 13:46:11 +0100 you wrote:
> ctrl_cmd_bye() and ctrl_cmd_del_client() forward the event to every
> local server, but stop at the first failed send. Each send goes to a
> different socket, so a single server with a full receive queue
> (-ENOSPC) hides the event from all servers after it.
> 
> Log the failure and carry on. Likewise, keep notifying local lookups
> when the NEW_SERVER broadcast fails, which can only happen on -ENOMEM.
> 
> [...]

Here is the summary with links:
  - [net,v2] net: qrtr: ns: keep notifying local servers after a failed send
    https://git.kernel.org/netdev/net/c/925120216e6d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads