Re: [PATCH v1 5/7] sunrpc: Enable calls to rpc_call_null_helper() from other modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Jan 27, 2017, at 5:07 PM, Anna Schumaker <schumaker.anna@xxxxxxxxx> wrote:
> 
> Hi Chuck,
> 
> On 01/26/2017 12:56 PM, Chuck Lever wrote:
>> I'd like to emit an RPC ping from rpcrdma.ko.
> 
> The patch itself looks fine, but I was wondering if you could add a few extra words to this sentence to say that it'll be for keepalive pings?

Check out:

http://git.linux-nfs.org/?p=cel/cel-2.6.git;a=commit;h=c07f835228bfbe0388a4d109899377bd48dd7eff

And feel free to suggest alternate text.


> Thanks,
> Anna
>> 
>> authnull_ops is not visible outside the sunrpc.ko module, so fold
>> the common case into rpc_call_null_helper, and export it.
>> 
>> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
>> ---
>> include/linux/sunrpc/clnt.h |    5 +++++
>> net/sunrpc/clnt.c           |   21 +++++++++++----------
>> 2 files changed, 16 insertions(+), 10 deletions(-)
>> 
>> diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
>> index 85cc819..a79237d 100644
>> --- a/include/linux/sunrpc/clnt.h
>> +++ b/include/linux/sunrpc/clnt.h
>> @@ -173,6 +173,11 @@ int		rpc_call_async(struct rpc_clnt *clnt,
>> 			       void *calldata);
>> int		rpc_call_sync(struct rpc_clnt *clnt,
>> 			      const struct rpc_message *msg, int flags);
>> +struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
>> +				      struct rpc_xprt *xprt,
>> +				      struct rpc_cred *cred, int flags,
>> +				      const struct rpc_call_ops *ops,
>> +				      void *data);
>> struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
>> 			       int flags);
>> int		rpc_restart_call_prepare(struct rpc_task *);
>> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
>> index 1efbe48..decaf97 100644
>> --- a/net/sunrpc/clnt.c
>> +++ b/net/sunrpc/clnt.c
>> @@ -2520,7 +2520,6 @@ static int rpc_ping(struct rpc_clnt *clnt)
>> 	return err;
>> }
>> 
>> -static
>> struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
>> 		struct rpc_xprt *xprt, struct rpc_cred *cred, int flags,
>> 		const struct rpc_call_ops *ops, void *data)
>> @@ -2537,9 +2536,17 @@ struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt,
>> 		.callback_data = data,
>> 		.flags = flags,
>> 	};
>> +	struct rpc_task *task;
>> 
>> -	return rpc_run_task(&task_setup_data);
>> +	if (!cred)
>> +		msg.rpc_cred = authnull_ops.lookup_cred(NULL, NULL, 0);
>> +	task = rpc_run_task(&task_setup_data);
>> +	if (!cred)
>> +		put_rpccred(msg.rpc_cred);
>> +
>> +	return task;
>> }
>> +EXPORT_SYMBOL_GPL(rpc_call_null_helper);
>> 
>> struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int flags)
>> {
>> @@ -2586,7 +2593,6 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt,
>> 		void *dummy)
>> {
>> 	struct rpc_cb_add_xprt_calldata *data;
>> -	struct rpc_cred *cred;
>> 	struct rpc_task *task;
>> 
>> 	data = kmalloc(sizeof(*data), GFP_NOFS);
>> @@ -2595,11 +2601,9 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt,
>> 	data->xps = xprt_switch_get(xps);
>> 	data->xprt = xprt_get(xprt);
>> 
>> -	cred = authnull_ops.lookup_cred(NULL, NULL, 0);
>> -	task = rpc_call_null_helper(clnt, xprt, cred,
>> +	task = rpc_call_null_helper(clnt, xprt, NULL,
>> 			RPC_TASK_SOFT|RPC_TASK_SOFTCONN|RPC_TASK_ASYNC,
>> 			&rpc_cb_add_xprt_call_ops, data);
>> -	put_rpccred(cred);
>> 	if (IS_ERR(task))
>> 		return PTR_ERR(task);
>> 	rpc_put_task(task);
>> @@ -2630,7 +2634,6 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt,
>> 				     struct rpc_xprt *xprt,
>> 				     void *data)
>> {
>> -	struct rpc_cred *cred;
>> 	struct rpc_task *task;
>> 	struct rpc_add_xprt_test *xtest = (struct rpc_add_xprt_test *)data;
>> 	int status = -EADDRINUSE;
>> @@ -2642,11 +2645,9 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt,
>> 		goto out_err;
>> 
>> 	/* Test the connection */
>> -	cred = authnull_ops.lookup_cred(NULL, NULL, 0);
>> -	task = rpc_call_null_helper(clnt, xprt, cred,
>> +	task = rpc_call_null_helper(clnt, xprt, NULL,
>> 				    RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
>> 				    NULL, NULL);
>> -	put_rpccred(cred);
>> 	if (IS_ERR(task)) {
>> 		status = PTR_ERR(task);
>> 		goto out_err;
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux