blob: 8e1d80927f7b59b0d0f43bcc74aee785b287cc23 [file]
From 2f0dde427cc3002333e32b2ef439f33f66b1e805 Mon Sep 17 00:00:00 2001
From: Sasha Levin <sashal@kernel.org>
Date: Tue, 27 Oct 2026 06:56:43 +0200
Subject: SUNRPC: Balance queue accounting when relocating a task
From: Avi Weiss <thnkslprpt@gmail.com>
[ Upstream commit f14b157168ac106cfac6d577e08726488b1b886c ]
When rpc_task_set_transport() relocates a movable task from an
offline transport, it releases the request and drops the
transport reference without decrementing the old transport's
queuelen or the switch's xps_queuelen. Releasing the task
later only accounts for the replacement transport.
The stale counts affect transport selection and can prevent
xprt_delete_locked() from removing an otherwise idle transport.
Use rpc_task_release_xprt() to balance the previous assignment
before selecting a replacement. Pass clnt explicitly because
rpc_task_set_client() can assign a transport before tk_client
is initialized.
Fixes: 82ee41b85cef ("SUNRPC don't resend a task on an offlined transport")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sunrpc/clnt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 6fc36e516c1c6..33e64c0225f37 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1197,7 +1197,7 @@ void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)
(task->tk_flags & RPC_TASK_MOVEABLE)))
return;
xprt_release(task);
- xprt_put(task->tk_xprt);
+ rpc_task_release_xprt(clnt, task->tk_xprt);
}
if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
task->tk_xprt = rpc_task_get_first_xprt(clnt);
--
2.53.0