5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Avi Weiss [ 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 Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- 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 7d7950068b030..799b61a1be010 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1084,7 +1084,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