pnfs/flexfiles: connect to NFSv3 DS using TLS if MDS connection uses TLS

Implementation follows bones of the pattern that was established in
commit a35518cae4 ("NFSv4.1/pnfs: fix NFS with TLS in pnfs").

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
This commit is contained in:
Mike Snitzer 2025-05-09 16:39:49 -04:00 committed by Anna Schumaker
parent 62d2cde203
commit 04a1526366
1 changed files with 10 additions and 1 deletions

View File

@ -830,10 +830,16 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv,
.servername = clp->cl_hostname, .servername = clp->cl_hostname,
.connect_timeout = connect_timeout, .connect_timeout = connect_timeout,
.reconnect_timeout = connect_timeout, .reconnect_timeout = connect_timeout,
.xprtsec = clp->cl_xprtsec,
}; };
if (da->da_transport != clp->cl_proto) if (da->da_transport != clp->cl_proto &&
clp->cl_proto != XPRT_TRANSPORT_TCP_TLS)
continue; continue;
if (da->da_transport == XPRT_TRANSPORT_TCP &&
mds_srv->nfs_client->cl_proto == XPRT_TRANSPORT_TCP_TLS)
xprt_args.ident = XPRT_TRANSPORT_TCP_TLS;
if (da->da_addr.ss_family != clp->cl_addr.ss_family) if (da->da_addr.ss_family != clp->cl_addr.ss_family)
continue; continue;
/* Add this address as an alias */ /* Add this address as an alias */
@ -841,6 +847,9 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv,
rpc_clnt_test_and_add_xprt, NULL); rpc_clnt_test_and_add_xprt, NULL);
continue; continue;
} }
if (da->da_transport == XPRT_TRANSPORT_TCP &&
mds_srv->nfs_client->cl_proto == XPRT_TRANSPORT_TCP_TLS)
da->da_transport = XPRT_TRANSPORT_TCP_TLS;
clp = get_v3_ds_connect(mds_srv, clp = get_v3_ds_connect(mds_srv,
&da->da_addr, &da->da_addr,
da->da_addrlen, da->da_transport, da->da_addrlen, da->da_transport,