aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2021-11-05 00:06:34 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2021-11-05 00:06:34 +0000
commit80e5955b085af20e65ef84066a164936413748e3 (patch)
treefbd7ae12754a5577a461dc2d039257297f490b4f
parentdd31400c3c2aa941d057e78296c193959a6d9ed3 (diff)
downloadsrc-80e5955b085af20e65ef84066a164936413748e3.tar.gz
src-80e5955b085af20e65ef84066a164936413748e3.zip
nfscl: Fix NFSv4.1/4.2 pnfs mounts using nconnect
When a mount with the "pnfs" and "nconnect" options specified does an I/O operation, it erroneously uses a TCP connection to the MDS when it is meant to be a DS operation and, as such, needs to use a TCP connection to the DS. This patch fixes this. When the "pnfs" and "nconnect" options are specified for a NFSv4.1/4.2 mount, there probably should be N connections established to each DS for I/O RPCs. This is a fair amount of work and may be done in a future commit. This problem was found during a recent IETF NFSv4 working group testing event. MFC after: 2 weeks
-rw-r--r--sys/fs/nfs/nfs_commonkrpc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 358d77fe5b30..c1a5fab2a358 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -639,8 +639,17 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
if (nrp->nr_client == NULL)
newnfs_connect(nmp, nrp, cred, td, 0, false, &nrp->nr_client);
+ /*
+ * If the "nconnect" mount option was specified and this RPC is
+ * one that can have a large RPC message and is being done through
+ * the NFS/MDS server, use an additional connection. (When the RPC is
+ * being done through the server/MDS, nrp == &nmp->nm_sockreq.)
+ * The "nconnect" mount option normally has minimal effect when the
+ * "pnfs" mount option is specified, since only Readdir RPCs are
+ * normally done through the NFS/MDS server.
+ */
nextconn_set = false;
- if (nmp != NULL && nmp->nm_aconnect > 0 &&
+ if (nmp != NULL && nmp->nm_aconnect > 0 && nrp == &nmp->nm_sockreq &&
(nd->nd_procnum == NFSPROC_READ ||
nd->nd_procnum == NFSPROC_READDIR ||
nd->nd_procnum == NFSPROC_READDIRPLUS ||