Skip to contentSkip to conversation

SUNRPC: Balance queue accounting when relocating a task

PATCH New Avi Weiss 1 participant 1 message Oct 27

Subsystems (3)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 SUNRPC: Balance queue accounting when relocating a task

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")
---
 net/sunrpc/clnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
index 6cedc824cf82..7e5d1dcf2804 100644
@@ -1194,7 +1194,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);

base-commit: 7be4bc52fd9e0e55dc9a2e0232b89427d2c4b614

Signature · 1 line
2.43.0