All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] NFSv4.1+ add trunking when server trunking detected
@ 2021-06-08 18:45 Olga Kornievskaia
  2021-06-08 20:41 ` Chuck Lever III
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Olga Kornievskaia @ 2021-06-08 18:45 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker; +Cc: linux-nfs

From: Olga Kornievskaia <kolga@netapp.com>

After trunking is discovered in nfs4_discover_server_trunking(),
add the transport to the old client structure before destroying
the new client structure (along with its transport).

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs4client.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 42719384e25f..984c851844d8 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -361,6 +361,44 @@ static int nfs4_init_client_minor_version(struct nfs_client *clp)
 	return nfs4_init_callback(clp);
 }
 
+static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old)
+{
+	struct sockaddr_storage clp_addr, old_addr;
+	struct sockaddr *clp_sap = (struct sockaddr *)&clp_addr;
+	struct sockaddr *old_sap = (struct sockaddr *)&old_addr;
+	size_t clp_salen, old_salen;
+	struct xprt_create xprt_args = {
+		.ident = old->cl_proto,
+		.net = old->cl_net,
+		.servername = old->cl_hostname,
+	};
+	struct nfs4_add_xprt_data xprtdata = {
+		.clp = old,
+	};
+	struct rpc_add_xprt_test rpcdata = {
+		.add_xprt_test = old->cl_mvops->session_trunk,
+		.data = &xprtdata,
+	};
+
+	if (clp->cl_proto != old->cl_proto)
+		return;
+	clp_salen = rpc_peeraddr(clp->cl_rpcclient, clp_sap, sizeof(clp_addr));
+	old_salen = rpc_peeraddr(old->cl_rpcclient, old_sap, sizeof(old_addr));
+
+	if (clp_addr.ss_family != old_addr.ss_family)
+		return;
+
+	xprt_args.dstaddr = clp_sap;
+	xprt_args.addrlen = clp_salen;
+
+	xprtdata.cred = nfs4_get_clid_cred(old);
+	rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
+			  rpc_clnt_setup_test_and_add_xprt, &rpcdata);
+
+	if (xprtdata.cred)
+		put_cred(xprtdata.cred);
+}
+
 /**
  * nfs4_init_client - Initialise an NFS4 client record
  *
@@ -434,6 +472,8 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
 		 * won't try to use it.
 		 */
 		nfs_mark_client_ready(clp, -EPERM);
+		if (old->cl_mvops->session_trunk)
+			nfs4_add_trunk(clp, old);
 	}
 	clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags);
 	nfs_put_client(clp);
-- 
2.27.0


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

end of thread, other threads:[~2021-06-09 20:47 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 18:45 [PATCH 1/1] NFSv4.1+ add trunking when server trunking detected Olga Kornievskaia
2021-06-08 20:41 ` Chuck Lever III
2021-06-08 20:56   ` Olga Kornievskaia
2021-06-08 21:06     ` Chuck Lever III
2021-06-08 21:19       ` Trond Myklebust
2021-06-08 21:26         ` Trond Myklebust
2021-06-08 21:30           ` Olga Kornievskaia
2021-06-08 21:41             ` Trond Myklebust
2021-06-08 22:21               ` Olga Kornievskaia
2021-06-08 22:31                 ` Trond Myklebust
2021-06-08 22:38                   ` Olga Kornievskaia
2021-06-08 23:02                     ` Trond Myklebust
2021-06-08 23:12                       ` Trond Myklebust
2021-06-08 21:40       ` Olga Kornievskaia
2021-06-08 22:13         ` Trond Myklebust
2021-06-08 22:18           ` Olga Kornievskaia
2021-06-08 22:27             ` Trond Myklebust
2021-06-08 22:38               ` Olga Kornievskaia
2021-06-08 22:58                 ` Trond Myklebust
2021-06-09 20:47       ` Olga Kornievskaia
2021-06-08 22:39 ` kernel test robot
2021-06-08 22:39   ` kernel test robot
2021-06-08 23:36 ` kernel test robot
2021-06-08 23:36   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.