summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2019-05-29 20:41:28 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-07-06 14:54:50 -0400
commit5a0c257f8e0f4c4b3c33dff545317c21a921303e (patch)
treea1b50f2ffd25d25819faaea8045e814edec64324 /net/sunrpc
parent53c326307156249253be36b33cd6c32f4a24f9b2 (diff)
NFS: send state management on a single connection.
With NFSv4.1, different network connections need to be explicitly bound to a session. During session startup, this is not possible so only a single connection must be used for session startup. So add a task flag to disable the default round-robin choice of connections (when nconnect > 1) and force the use of a single connection. Then use that flag on all requests for session management - for consistence, include NFSv4.0 management (SETCLIENTID) and session destruction Reported-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index b6aca8cb5ae6..d599fab8adcb 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -995,6 +995,24 @@ rpc_task_get_xprt(struct rpc_clnt *clnt)
995 return xprt; 995 return xprt;
996} 996}
997 997
998static struct rpc_xprt *
999rpc_task_get_first_xprt(struct rpc_clnt *clnt)
1000{
1001 struct rpc_xprt_switch *xps;
1002 struct rpc_xprt *xprt;
1003
1004 rcu_read_lock();
1005 xprt = xprt_get(rcu_dereference(clnt->cl_xprt));
1006 if (xprt) {
1007 atomic_long_inc(&xprt->queuelen);
1008 xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch);
1009 atomic_long_inc(&xps->xps_queuelen);
1010 }
1011 rcu_read_unlock();
1012
1013 return xprt;
1014}
1015
998static void 1016static void
999rpc_task_release_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt) 1017rpc_task_release_xprt(struct rpc_clnt *clnt, struct rpc_xprt *xprt)
1000{ 1018{
@@ -1042,7 +1060,11 @@ void rpc_task_release_client(struct rpc_task *task)
1042static 1060static
1043void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt) 1061void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt)
1044{ 1062{
1045 if (!task->tk_xprt) 1063 if (task->tk_xprt)
1064 return;
1065 if (task->tk_flags & RPC_TASK_NO_ROUND_ROBIN)
1066 task->tk_xprt = rpc_task_get_first_xprt(clnt);
1067 else
1046 task->tk_xprt = rpc_task_get_xprt(clnt); 1068 task->tk_xprt = rpc_task_get_xprt(clnt);
1047} 1069}
1048 1070