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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 7 13:53:25 MSK 2017


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 at 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 at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai 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);
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 
 	if (!sn->kill_tasks)


More information about the Devel mailing list