Re: [PATCH] SUNRPC: @clnt specifies auth flavor of RPC ping
From: Trond Myklebust <hidden>
Date: 2023-05-23 04:04:24
On Mon, 2023-05-22 at 22:37 -0400, Chuck Lever wrote:
On Mon, May 22, 2023 at 05:21:22PM -0400, Chuck Lever wrote:quoted
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.
rpc_ping() should not need to know about the existence of AUTH_TLS. Let's rather add in a struct rpc_authops callback connect_ping() (?) that knows how to call rpc_ping() with the appropriate creds. For the AUTH types other than AUTH_TLS, that will be a generic call with the AUTH_NULL cred. Then let's get rid of the RPC_TASK_NULLCREDS wart altogether.
quoted
+ + task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); status = task->tk_status;
-- Trond Myklebust Linux NFS client maintainer, Hammerspace trond.myklebust@hammerspace.com