Skip to contentSkip to conversation

SUNRPC: call_connect_status needs to destroy transport on ETIMEDOUT before retry

PATCH In review Dai Ngo 2 participants 2 messages Aug 4, 2025

Subsystems (3)
lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH 1/1 SUNRPC: call_connect_status needs to destroy transport on ETIMEDOUT before retry

Currently, when an RPC connection times out during the connect phase, the task is retried by placing it back on the pending queue and waiting again. In some cases, the timeout occurs because TCP is unable to send the SYN packet. This situation most often arises on bare metal systems at boot time, when the NFS mount is attempted while the network link appears to be up but is not yet stable.

This patch addresses the issue by updating call_connect_status to destroy the transport on ETIMEDOUT error before retrying the connection. This ensures that subsequent connection attempts use a fresh transport, reducing the likelihood of repeated failures due to lingering network issues.

---
 net/sunrpc/clnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
index 21426c3049d3..701b742750c5 100644
@@ -2215,6 +2215,7 @@ call_connect_status(struct rpc_task *task)
 	case -EHOSTUNREACH:
 	case -EPIPE:
 	case -EPROTO:
+	case -ETIMEDOUT:
 		xprt_conditional_disconnect(task->tk_rqstp->rq_xprt,
 					    task->tk_rqstp->rq_connect_cookie);
 		if (RPC_IS_SOFTCONN(task))
@@ -2225,7 +2226,6 @@ call_connect_status(struct rpc_task *task)
 	case -EADDRINUSE:
 	case -ENOTCONN:
 	case -EAGAIN:
-	case -ETIMEDOUT:
 		if (!(task->tk_flags & RPC_TASK_NO_ROUND_ROBIN) &&
 		    (task->tk_flags & RPC_TASK_MOVEABLE) &&
 		    test_bit(XPRT_REMOVE, &xprt->state)) {
Signature · 1 line
2.43.5
#1 lore raw
Quoted 31 lines · Dai Ngo

Currently, when an RPC connection times out during the connect phase, the task is retried by placing it back on the pending queue and waiting again. In some cases, the timeout occurs because TCP is unable to send the SYN packet. This situation most often arises on bare metal systems at boot time, when the NFS mount is attempted while the network link appears to be up but is not yet stable.

This patch addresses the issue by updating call_connect_status to destroy the transport on ETIMEDOUT error before retrying the connection. This ensures that subsequent connection attempts use a fresh transport, reducing the likelihood of repeated failures due to lingering network issues.

---
 net/sunrpc/clnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -0
index 21426c3049d3..701b742750c5 100644
@@ -2215,6 +2215,7 @@ call_connect_status(struct rpc_task *task)
 	case -EHOSTUNREACH:
 	case -EPIPE:
 	case -EPROTO:
+	case -ETIMEDOUT:
 		xprt_conditional_disconnect(task->tk_rqstp->rq_xprt,
 					    task->tk_rqstp->rq_connect_cookie);
 		if (RPC_IS_SOFTCONN(task))

net/sunrpc/clnt.c call_connect_status(struct rpc_task *task) · line 2231

Quoted 7 lines
net/sunrpc/clnt.c +0 -1
@@ -2225,7 +2226,6 @@ call_connect_status(struct rpc_task *task)
 	case -EADDRINUSE:
 	case -ENOTCONN:
 	case -EAGAIN:
-	case -ETIMEDOUT:
 		if (!(task->tk_flags & RPC_TASK_NO_ROUND_ROBIN) &&
 		    (task->tk_flags & RPC_TASK_MOVEABLE) &&
 		    test_bit(XPRT_REMOVE, &xprt->state)) {

Hello Dai, net/sunrpc/clnt.c is client-side. Can you resend to Trond and Anna, please?

Signature · 1 line
Chuck Lever