[Devel] [PATCH] sunrpc: take net from task client only is available

Kirill Tkhai ktkhai at virtuozzo.com
Tue Aug 1 16:50:51 MSK 2017


On 01.08.2017 14:16, Stanislav Kinsburskiy wrote:
> SUNRPC task can have no RPC client, but RPC request instead (this is a piece
> of NFSv4.1 callback magic).
> In this case network has be taken from tk->rqstp object.
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
>  net/sunrpc/clnt.c |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index 4a2fe46..e87dc47 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -2625,9 +2625,16 @@ void rpc_task_kill_proc_fini(struct net *net)
>  		remove_proc_entry("kill-tasks", sn->proc_net_rpc);
>  }
>  
> +static struct net *rpc_task_net(struct rpc_task *task)
> +{
> +	if (task->tk_client)
> +		return rpc_net_ns(task->tk_client);
> +	return task->tk_rqstp->rq_xprt->xprt_net;
> +}
> +
>  bool rpc_abort_task(struct rpc_task *task)
>  {
> -	struct net *net = rpc_net_ns(task->tk_client);
> +	struct net *net = rpc_task_net(task);

I have no objections, but just for sure, are there places we also need such changes?

>  	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
>  
>  	if (!sn->kill_tasks)
> 


More information about the Devel mailing list