public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sunrpc: Add xprt after nfs4_test_session_trunk()
@ 2018-12-11  9:58 Santosh kumar pradhan
  2018-12-11 10:10 ` Suresh Jayaraman
  2018-12-14 21:32 ` Trond Myklebust
  0 siblings, 2 replies; 3+ messages in thread
From: Santosh kumar pradhan @ 2018-12-11  9:58 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker; +Cc: linux-nfs, Santosh Kumar Pradhan

From: Santosh Kumar Pradhan <santoshkumar.pradhan@wdc.com>

Multipathing: In case of NFSv3, rpc_clnt_test_and_add_xprt() adds
the xprt to xprt switch (i.e. xps) if rpc_call_null_helper() returns
success. But in case of NFSv4.1, it needs to do EXCHANGEID to verify
the path along with check for session trunking.

Add the xprt once nfs4_test_session_trunk() returns success.
Also release refcount hold by rpc_clnt_setup_test_and_add_xprt().

Signed-off-by: Santosh Kumar Pradhan <santoshkumar.pradhan@wdc.com>
Tested-by: Suresh Jayaraman <suresh.jayaraman@wdc.com>
---
 net/sunrpc/clnt.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index d839c33ae7d9..053f594cc144 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2654,10 +2654,14 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt,
 		goto out_err;
 
 	/* rpc_xprt_switch and rpc_xprt are deferrenced by add_xprt_test() */
-	xtest->add_xprt_test(clnt, xprt, xtest->data);
+	status = xtest->add_xprt_test(clnt, xprt, xtest->data);
+	if (status != 0)
+		goto out_err;
 
-	/* so that rpc_clnt_add_xprt does not call rpc_xprt_switch_add_xprt */
-	return 1;
+	xprt_put(xprt);
+	xprt_switch_put(xps);
+	/* so that rpc_clnt_add_xprt calls rpc_xprt_switch_add_xprt */
+	return 0;
 out_err:
 	xprt_put(xprt);
 	xprt_switch_put(xps);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-14 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-11  9:58 [PATCH] sunrpc: Add xprt after nfs4_test_session_trunk() Santosh kumar pradhan
2018-12-11 10:10 ` Suresh Jayaraman
2018-12-14 21:32 ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox