diff mbox series

[v2,07/15] SUNRPC: Refactor rpc_call_null_helper()

Message ID 165452707392.1496.12861225717405665289.stgit@oracle-102.nfsv4.dev (mailing list archive)
State New, archived
Headers show
Series RPC-with-TLS client side | expand

Commit Message

Chuck Lever June 6, 2022, 2:51 p.m. UTC
I'm about to add a use case that does not want RPC_TASK_NULLCREDS.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/clnt.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Jeff Layton July 18, 2022, 7:44 p.m. UTC | #1
On Mon, 2022-06-06 at 10:51 -0400, Chuck Lever wrote:
> I'm about to add a use case that does not want RPC_TASK_NULLCREDS.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  net/sunrpc/clnt.c |   15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index 0ca86c92968f..ade83ee13bac 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -2751,8 +2751,7 @@ struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
>  		.rpc_op_cred = cred,
>  		.callback_ops = ops ?: &rpc_null_ops,
>  		.callback_data = data,
> -		.flags = flags | RPC_TASK_SOFT | RPC_TASK_SOFTCONN |
> -			 RPC_TASK_NULLCREDS,
> +		.flags = flags | RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
>  	};
>  
>  	return rpc_run_task(&task_setup_data);
> @@ -2760,7 +2759,8 @@ struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
>  
>  struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int flags)
>  {
> -	return rpc_call_null_helper(clnt, NULL, cred, flags, NULL, NULL);
> +	return rpc_call_null_helper(clnt, NULL, cred, flags | RPC_TASK_NULLCREDS,
> +				    NULL, NULL);
>  }
>  EXPORT_SYMBOL_GPL(rpc_call_null);
>  
> @@ -2860,9 +2860,11 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt,
>  		goto success;
>  	}
>  
> -	task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC,
> -			&rpc_cb_add_xprt_call_ops, data);
> +	task = rpc_call_null_helper(clnt, xprt, NULL,
> +				    RPC_TASK_ASYNC | RPC_TASK_NULLCREDS,
> +				    &rpc_cb_add_xprt_call_ops, data);
>  	data->xps->xps_nunique_destaddr_xprts++;
> +
>  	rpc_put_task(task);
>  success:
>  	return 1;
> @@ -2903,7 +2905,8 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt,
>  		goto out_err;
>  
>  	/* Test the connection */
> -	task = rpc_call_null_helper(clnt, xprt, NULL, 0, NULL, NULL);
> +	task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_NULLCREDS,
> +				    NULL, NULL);
>  	if (IS_ERR(task)) {
>  		status = PTR_ERR(task);
>  		goto out_err;
> 
> 

Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0ca86c92968f..ade83ee13bac 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2751,8 +2751,7 @@  struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
 		.rpc_op_cred = cred,
 		.callback_ops = ops ?: &rpc_null_ops,
 		.callback_data = data,
-		.flags = flags | RPC_TASK_SOFT | RPC_TASK_SOFTCONN |
-			 RPC_TASK_NULLCREDS,
+		.flags = flags | RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
 	};
 
 	return rpc_run_task(&task_setup_data);
@@ -2760,7 +2759,8 @@  struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
 
 struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int flags)
 {
-	return rpc_call_null_helper(clnt, NULL, cred, flags, NULL, NULL);
+	return rpc_call_null_helper(clnt, NULL, cred, flags | RPC_TASK_NULLCREDS,
+				    NULL, NULL);
 }
 EXPORT_SYMBOL_GPL(rpc_call_null);
 
@@ -2860,9 +2860,11 @@  int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt,
 		goto success;
 	}
 
-	task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC,
-			&rpc_cb_add_xprt_call_ops, data);
+	task = rpc_call_null_helper(clnt, xprt, NULL,
+				    RPC_TASK_ASYNC | RPC_TASK_NULLCREDS,
+				    &rpc_cb_add_xprt_call_ops, data);
 	data->xps->xps_nunique_destaddr_xprts++;
+
 	rpc_put_task(task);
 success:
 	return 1;
@@ -2903,7 +2905,8 @@  int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt,
 		goto out_err;
 
 	/* Test the connection */
-	task = rpc_call_null_helper(clnt, xprt, NULL, 0, NULL, NULL);
+	task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_NULLCREDS,
+				    NULL, NULL);
 	if (IS_ERR(task)) {
 		status = PTR_ERR(task);
 		goto out_err;