Re: [PATCH] SUNRPC: @clnt specifies auth flavor of RPC ping
From: Chuck Lever <cel@kernel.org>
Date: 2023-05-23 02:38:04
On Mon, May 22, 2023 at 05:21:22PM -0400, Chuck Lever wrote:
quoted hunk ↗ jump to hunk
From: Chuck Lever <chuck.lever@oracle.com> When connecting, we don't want to send both a NULL ping and an RPC_AUTH_TLS probe, because, except for the detection of RPC-with- TLS support, both serve effectively the same purpose. Modify rpc_ping() so it can send a TLS probe when @clnt's flavor is RPC_AUTH_TLS. All other callers continue to use AUTH_NONE. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/clnt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) Does it help to replace 4/12 with this? Compile-tested only.diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 4cdb539b5854..274ad74cb2bd 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c@@ -2826,10 +2826,22 @@ EXPORT_SYMBOL_GPL(rpc_call_null); static int rpc_ping(struct rpc_clnt *clnt) { + struct rpc_message msg = { + .rpc_proc = &rpcproc_null, + }; + struct rpc_task_setup task_setup_data = { + .rpc_client = clnt, + .rpc_message = &msg, + .callback_ops = &rpc_null_ops, + .flags = RPC_TASK_SOFT | RPC_TASK_SOFTCONN, + }; struct rpc_task *task; int status; - task = rpc_call_null_helper(clnt, NULL, NULL, 0, NULL, NULL); + if (clnt->cl_auth->au_flavor != RPC_AUTH_TLS) + flags |= RPC_TASK_NULLCREDS;
Obviously this needs to be: task_setup_data.flags |= RPC_TASK_NULLCREDS; This has been fixed in the topic-rpc-with-tls-upcall branch.
+ + task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); status = task->tk_status;