NFS: inherit parent transport protocol for referral mounts
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): CAJiE4OkW6XT71xvv49VN5STPx7dQ6GxV+-Rz1=55JhoFPyM7PQ@mail.gmail.com
PATCH v2 1/1 NFS: inherit parent transport protocol for referral mounts
When following NFS referrals, the client always attempts RDMA first (if compiled in), even when the parent mount uses TCP. This causes unnecessary timeouts when the referral server doesn't support RDMA.
Modify nfs4_create_referral_server() to check the parent client's transport protocol. Only attempt RDMA if the parent is using RDMA, otherwise use the parent's protocol (TCP/TCP-TLS) directly.
This eliminates connection delays for TCP-based referrals in environments where RDMA is compiled in but not deployed.
---
Changes since v1:
- Removed module parameter.
--- fs/nfs/nfs4client.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
fs/nfs/nfs4client.c +12 -5
@@ -1258,12 +1258,19 @@ struct nfs_server *nfs4_create_referral_server(struct fs_context *fc)nfs_server_copy_userdata (server, parent_server);/* Get a client representation */ +/* +* Only try RDMA if the parent client is using RDMA. This avoids +* connection delays when parent uses TCP and referral server doesn't +* support RDMA. +*/ #if IS_ENABLED (CONFIG_SUNRPC_XPRT_RDMA ) -rpc_set_port (&ctx->nfs_server.address,NFS_RDMA_PORT ); - cl_init.proto =XPRT_TRANSPORT_RDMA ; - error =nfs4_set_client (server, &cl_init); -if (!error) - goto init_server; +if (parent_client->cl_proto ==XPRT_TRANSPORT_RDMA ) { +rpc_set_port (&ctx->nfs_server.address,NFS_RDMA_PORT ); + cl_init.proto =XPRT_TRANSPORT_RDMA ; + error =nfs4_set_client (server, &cl_init); +if (!error) + goto init_server; + }#endif /* IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA) */ cl_init.proto =XPRT_TRANSPORT_TCP ;
Signature · 1 line
2.43.7
Chuck Lever
maintainerQuoted 49 lines · Gaurav Gangalwar
When following NFS referrals, the client always attempts RDMA first (if compiled in), even when the parent mount uses TCP. This causes unnecessary timeouts when the referral server doesn't support RDMA.
Modify
nfs4_create_referral_server()to check the parent client's transport protocol. Only attempt RDMA if the parent is using RDMA, otherwise use the parent's protocol (TCP/TCP-TLS) directly.This eliminates connection delays for TCP-based referrals in environments where RDMA is compiled in but not deployed.
Signed-off-by Gaurav Gangalwar <[email protected]>---
Changes since v1:
- Removed module parameter.--- fs/nfs/nfs4client.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)fs/nfs/nfs4client.c +12
-5@@ -1258,12 +1258,19 @@ struct nfs_server *nfs4_create_referral_server(struct fs_context *fc)nfs_server_copy_userdata (server, parent_server);/* Get a client representation */ +/* +* Only try RDMA if the parent client is using RDMA. This avoids +* connection delays when parent uses TCP and referral server doesn't +* support RDMA. +*/ #if IS_ENABLED (CONFIG_SUNRPC_XPRT_RDMA ) -rpc_set_port (&ctx->nfs_server.address,NFS_RDMA_PORT ); - cl_init.proto =XPRT_TRANSPORT_RDMA ; - error =nfs4_set_client (server, &cl_init); -if (!error) - goto init_server; +if (parent_client->cl_proto ==XPRT_TRANSPORT_RDMA ) { +rpc_set_port (&ctx->nfs_server.address,NFS_RDMA_PORT ); + cl_init.proto =XPRT_TRANSPORT_RDMA ; + error =nfs4_set_client (server, &cl_init); +if (!error) + goto init_server; + }#endif /* IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA) */
Quoted 3 lines
cl_init.proto =
XPRT_TRANSPORT_TCP;Signature · 1 line
2.43.7
The reason it tries RDMA first is because RDMA is supposed to fail quickly when there's no RDMA-capable path to the remote. If RDMA is taking a long time to fail, there's a problem elsewhere.
Signature · 1 line
Chuck Lever
A message that is not in the archive (sent off-list or not yet received): CAJiE4O=gK4A8zJVXKGawqb=hx9uwNXNfh1yotVkDDmSfM1DA2A@mail.gmail.com
Chuck Lever
maintainerQuoted 65 lines · gaurav gangalwar
Reply inline
Quoted 53 lines · Chuck Lever
Quoted 25 lines · Gaurav Gangalwar
When following NFS referrals, the client always attempts RDMA first (if compiled in), even when the parent mount uses TCP. This causes unnecessary timeouts when the referral server doesn't support RDMA.
Modify
nfs4_create_referral_server()to check the parent client's transport protocol. Only attempt RDMA if the parent is using RDMA, otherwise use the parent's protocol (TCP/TCP-TLS) directly.This eliminates connection delays for TCP-based referrals in environments where RDMA is compiled in but not deployed.
Signed-off-by Gaurav Gangalwar <[email protected]>---
Changes since v1:
- Removed module parameter.--- fs/nfs/nfs4client.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)fs/nfs/nfs4client.c +0
-0fs/nfs/nfs4client.c struct nfs_server · line 1264
Quoted 7 lines
fs/nfs/nfs4client.c +3
-0@@ -1258,12 +1258,19 @@ struct nfs_server *nfs4_create_referral_server(struct fs_context *fc)nfs_server_copy_userdata (server, parent_server);/* Get a client representation */ +/* +* Only try RDMA if the parent client is using RDMA. This avoids +* connection delays when parent uses TCP and referral server doesn't
Quoted 17 lines
fs/nfs/nfs4client.c +9
-5+* support RDMA. +*/ #if IS_ENABLED (CONFIG_SUNRPC_XPRT_RDMA ) -rpc_set_port (&ctx->nfs_server.address,NFS_RDMA_PORT ); - cl_init.proto =XPRT_TRANSPORT_RDMA ; - error =nfs4_set_client (server, &cl_init); -if (!error) - goto init_server; +if (parent_client->cl_proto ==XPRT_TRANSPORT_RDMA ) { +rpc_set_port (&ctx->nfs_server.address,NFS_RDMA_PORT ); + cl_init.proto =XPRT_TRANSPORT_RDMA ; + error =nfs4_set_client (server, &cl_init); +if (!error) + goto init_server; + }#endif /* IS_ENABLED(CONFIG_SUNRPC_XPRT_RDMA) */ Quoted 8 lines
Quoted 3 lines
cl_init.proto = XPRT_TRANSPORT_TCP;--
2.43.7The reason it tries RDMA first is because RDMA is supposed to fail quickly when there's no RDMA-capable path to the remote. If RDMA is taking a long time to fail, there's a problem elsewhere.
Quoted 5 lines
Yes, if client is not RDMA capable then it fails quickly since transport class won't be registered and
xprt_create_transportwill fail early without even trying to connect as we check forxprt_class_find_by_ident. But when client is RDMA capable but server is not then it tries to connect and times out after 3 mins.
The client should be able to tell quickly that there is not a complete RDMA-enabled path from client to server. Can you describe your network?
Signature · 1 line
Chuck Lever