Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] net: qrtr: ns: keep notifying local servers after a failed send
@ 2026-11-14 12:46 Igor Opaniuk
  2026-11-21  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Opaniuk @ 2026-11-14 12:46 UTC (permalink / raw)
  To: Manivannan Sadhasivam, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman
  Cc: linux-arm-msm, netdev, linux-kernel, Chris Lew, Igor Opaniuk

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>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-21  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 12:46 [PATCH net v2] net: qrtr: ns: keep notifying local servers after a failed send Igor Opaniuk
2026-11-21  2:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox