[Devel,RHEL7,COMMIT] sunrpc: take net from task client only is available

Submitted by Konstantin Khorenko on Aug. 7, 2017, 10:53 a.m.

Details

Message ID 201708071053.v77ArPfi008414@finist_cl7.x64_64.work.ct
State New
Series "sunrpc: take net from task client only is available"
Headers show

Commit Message

Konstantin Khorenko Aug. 7, 2017, 10:53 a.m.
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.22
------>
commit 87bd0a23084d715b2c0eba3f385503b3fac59ae0
Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Date:   Mon Aug 7 14:53:25 2017 +0400

    sunrpc: take net from task client only is available
    
    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.
    
    https://jira.sw.ru/browse/PSBM-69434
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 net/sunrpc/clnt.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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);
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
 	if (!sn->kill_tasks)

Comments

Konstantin Khorenko Aug. 7, 2017, 10:56 a.m.
Please consider creating a ReadyKernel patch for it (for vz7 update 5 kernel only - vz7.33.22).

https://readykernel.com/

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 08/07/2017 01:53 PM, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-514.26.1.vz7.33.22
> ------>
> commit 87bd0a23084d715b2c0eba3f385503b3fac59ae0
> Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
> Date:   Mon Aug 7 14:53:25 2017 +0400
>
>     sunrpc: take net from task client only is available
>
>     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.
>
>     https://jira.sw.ru/browse/PSBM-69434
>
>     Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
>     Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>