Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Nov 2019 06:16:00 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r354329 - in projects/nfsv42/sys/fs: nfs nfsclient nfsserver
Message-ID:  <201911040616.xA46G0As003265@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Mon Nov  4 06:16:00 2019
New Revision: 354329
URL: https://svnweb.freebsd.org/changeset/base/354329

Log:
  Fix up the NFSv4.2 client/server for pNFS.
  
  This patch consists of assorted fixes needed to make NFSv4.2 work when
  the server is a pNFS server. Mostly it consists of fixes so that the client
  and layouts use the correct minor version number.
  A small fix to the generic newnfs_request() function was needed so that
  it properly handles a server reply of NFSERR_MINORVERMISMATCH.
  This only matters for NFSv4.2, since it is used to determine which minor
  version the DS for a File Layout pNFS server needs.
  Also, the patch adds two new sysctls, so that the minor versions of NFSv4
  handled by the server can be limited.

Modified:
  projects/nfsv42/sys/fs/nfs/nfs.h
  projects/nfsv42/sys/fs/nfs/nfs_commonkrpc.c
  projects/nfsv42/sys/fs/nfs/nfs_var.h
  projects/nfsv42/sys/fs/nfs/nfsclstate.h
  projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c
  projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c
  projects/nfsv42/sys/fs/nfsserver/nfs_nfsdsocket.c
  projects/nfsv42/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: projects/nfsv42/sys/fs/nfs/nfs.h
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfs.h	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfs/nfs.h	Mon Nov  4 06:16:00 2019	(r354329)
@@ -335,6 +335,7 @@ struct nfsreferral {
 #define	LCL_NFSV41		0x00020000
 #define	LCL_DONEBINDCONN	0x00040000
 #define	LCL_RECLAIMONEFS	0x00080000
+#define	LCL_NFSV42		0x00100000
 
 #define	LCL_GSS		LCL_KERBV	/* Or of all mechs */
 

Modified: projects/nfsv42/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfs_commonkrpc.c	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfs/nfs_commonkrpc.c	Mon Nov  4 06:16:00 2019	(r354329)
@@ -918,7 +918,8 @@ tryagain:
 		 * Get rid of the tag, return count and SEQUENCE result for
 		 * NFSv4.
 		 */
-		if ((nd->nd_flag & ND_NFSV4) != 0) {
+		if ((nd->nd_flag & ND_NFSV4) != 0 && nd->nd_repstat !=
+		    NFSERR_MINORVERMISMATCH) {
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			i = fxdr_unsigned(int, *tl);
 			error = nfsm_advance(nd, NFSM_RNDUP(i), -1);

Modified: projects/nfsv42/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfs_var.h	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfs/nfs_var.h	Mon Nov  4 06:16:00 2019	(r354329)
@@ -523,10 +523,11 @@ int nfsrpc_delegreturn(struct nfscldeleg *, struct ucr
 int nfsrpc_getacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);
 int nfsrpc_setacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);
 int nfsrpc_exchangeid(struct nfsmount *, struct nfsclclient *,
-    struct nfssockreq *, uint32_t, struct nfsclds **, struct ucred *,
+    struct nfssockreq *, int, uint32_t, struct nfsclds **, struct ucred *,
     NFSPROC_T *);
 int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
-    struct nfssockreq *, uint32_t, int, struct ucred *, NFSPROC_T *);
+    struct nfssockreq *, struct nfsclds *, uint32_t, int, struct ucred *,
+    NFSPROC_T *);
 int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *,
     struct ucred *, NFSPROC_T *);
 int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,

Modified: projects/nfsv42/sys/fs/nfs/nfsclstate.h
==============================================================================
--- projects/nfsv42/sys/fs/nfs/nfsclstate.h	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfs/nfsclstate.h	Mon Nov  4 06:16:00 2019	(r354329)
@@ -74,7 +74,7 @@ struct nfsclsession {
 
 /*
  * This structure holds the session, clientid and related information
- * needed for an NFSv4.1 Meta Data Server (MDS) or Data Server (DS).
+ * needed for an NFSv4.1 or NFSv4.2 Meta Data Server (MDS) or Data Server (DS).
  * It is malloc'd to the correct length.
  */
 struct nfsclds {
@@ -97,6 +97,7 @@ struct nfsclds {
 #define	NFSCLDS_DS		0x0004
 #define	NFSCLDS_CLOSED		0x0008
 #define	NFSCLDS_SAMECONN	0x0010
+#define	NFSCLDS_MINORV2		0x0020
 
 struct nfsclclient {
 	LIST_ENTRY(nfsclclient) nfsc_list;

Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfsclient/nfs_clrpcops.c	Mon Nov  4 06:16:00 2019	(r354329)
@@ -149,7 +149,8 @@ static int nfsrpc_getlayout(struct nfsmount *, vnode_t
     uint32_t *, nfsv4stateid_t *, uint64_t, struct nfscllayout **,
     struct ucred *, NFSPROC_T *);
 static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_in *,
-    struct sockaddr_in6 *, sa_family_t, int, struct nfsclds **, NFSPROC_T *);
+    struct sockaddr_in6 *, sa_family_t, int, int, struct nfsclds **,
+    NFSPROC_T *);
 static void nfscl_initsessionslots(struct nfsclsession *);
 static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *,
     nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *,
@@ -956,12 +957,12 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli
 		 * previous session has failed, so...
 		 * do an ExchangeID followed by the CreateSession.
 		 */
-		error = nfsrpc_exchangeid(nmp, clp, &nmp->nm_sockreq,
+		error = nfsrpc_exchangeid(nmp, clp, &nmp->nm_sockreq, 0,
 		    NFSV4EXCH_USEPNFSMDS | NFSV4EXCH_USENONPNFS, &dsp, cred, p);
 		NFSCL_DEBUG(1, "aft exch=%d\n", error);
 		if (error == 0)
 			error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess,
-			    &nmp->nm_sockreq,
+			    &nmp->nm_sockreq, NULL,
 			    dsp->nfsclds_sess.nfsess_sequenceid, 1, cred, p);
 		if (error == 0) {
 			NFSLOCKMNT(nmp);
@@ -4668,8 +4669,8 @@ nfsrpc_setaclrpc(vnode_t vp, struct ucred *cred, NFSPR
  */
 int
 nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclclient *clp,
-    struct nfssockreq *nrp, uint32_t exchflags, struct nfsclds **dspp,
-    struct ucred *cred, NFSPROC_T *p)
+    struct nfssockreq *nrp, int minorvers, uint32_t exchflags,
+    struct nfsclds **dspp, struct ucred *cred, NFSPROC_T *p)
 {
 	uint32_t *tl, v41flags;
 	struct nfsrv_descript nfsd;
@@ -4679,7 +4680,10 @@ nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclcl
 	int error, len;
 
 	*dspp = NULL;
-	nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL, 0, 0);
+	if (minorvers == 0)
+		minorvers = nmp->nm_minorvers;
+	nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL,
+	    NFS_VER4, minorvers);
 	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
 	*tl++ = txdr_unsigned(nfsboottime.tv_sec);	/* Client owner */
 	*tl = txdr_unsigned(clp->nfsc_rev);
@@ -4730,6 +4734,8 @@ nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclcl
 		}
 		if ((v41flags & NFSV4EXCH_USEPNFSDS) != 0)
 			dsp->nfsclds_flags |= NFSCLDS_DS;
+		if (minorvers == NFSV42_MINORVERSION)
+			dsp->nfsclds_flags |= NFSCLDS_MINORV2;
 		if (len > 0)
 			nd->nd_repstat = nfsrv_mtostr(nd,
 			    dsp->nfsclds_serverown, len);
@@ -4753,21 +4759,27 @@ nfsmout:
  */
 int
 nfsrpc_createsession(struct nfsmount *nmp, struct nfsclsession *sep,
-    struct nfssockreq *nrp, uint32_t sequenceid, int mds, struct ucred *cred,
-    NFSPROC_T *p)
+    struct nfssockreq *nrp, struct nfsclds *dsp, uint32_t sequenceid, int mds,
+    struct ucred *cred, NFSPROC_T *p)
 {
 	uint32_t crflags, maxval, *tl;
 	struct nfsrv_descript nfsd;
 	struct nfsrv_descript *nd = &nfsd;
-	int error, irdcnt;
+	int error, irdcnt, minorvers;
 
 	/* Make sure nm_rsize, nm_wsize is set. */
 	if (nmp->nm_rsize > NFS_MAXBSIZE || nmp->nm_rsize == 0)
 		nmp->nm_rsize = NFS_MAXBSIZE;
 	if (nmp->nm_wsize > NFS_MAXBSIZE || nmp->nm_wsize == 0)
 		nmp->nm_wsize = NFS_MAXBSIZE;
-	nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL, 0,
-	    0);
+	if (dsp == NULL)
+		minorvers = nmp->nm_minorvers;
+	else if ((dsp->nfsclds_flags & NFSCLDS_MINORV2) != 0)
+		minorvers = NFSV42_MINORVERSION;
+	else
+		minorvers = NFSV41_MINORVERSION;
+	nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL,
+	    NFS_VER4, minorvers);
 	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
 	*tl++ = sep->nfsess_clientid.lval[0];
 	*tl++ = sep->nfsess_clientid.lval[1];
@@ -4984,7 +4996,8 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 	struct sockaddr_in6 sin6, ssin6;
 	struct nfsclds *dsp = NULL, **dspp, **gotdspp;
 	struct nfscldevinfo *ndi;
-	int addrcnt = 0, bitcnt, error, gotvers, i, isudp, j, stripecnt;
+	int addrcnt = 0, bitcnt, error, gotminor, gotvers, i, isudp, j;
+	int stripecnt;
 	uint8_t stripeindex;
 	sa_family_t af, safilled;
 
@@ -5116,7 +5129,8 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 			}
 		}
 
-		gotvers = NFS_VER4;	/* Always NFSv4 for File Layout. */
+		gotvers = NFS_VER4;	/* Default NFSv4.1 for File Layout. */
+		gotminor = NFSV41_MINORVERSION;
 		/* For Flex File, we will take one of the versions to use. */
 		if (layouttype == NFSLAYOUT_FLEXFILE) {
 			NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
@@ -5127,15 +5141,19 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 				goto nfsmout;
 			}
 			gotvers = 0;
+			gotminor = 0;
 			for (i = 0; i < j; i++) {
 				NFSM_DISSECT(tl, uint32_t *, 5 * NFSX_UNSIGNED);
 				vers = fxdr_unsigned(uint32_t, *tl++);
 				minorvers = fxdr_unsigned(uint32_t, *tl++);
-				if ((vers == NFS_VER4 && (minorvers ==
-				    NFSV41_MINORVERSION || minorvers ==
-				    NFSV42_MINORVERSION)) || (vers ==
-				    NFS_VER3 && gotvers == 0)) {
+				if (vers == NFS_VER3)
+					minorvers = 0;
+				if ((vers == NFS_VER4 && ((minorvers ==
+				    NFSV41_MINORVERSION && gotminor == 0) ||
+				    minorvers == NFSV42_MINORVERSION)) ||
+				    (vers == NFS_VER3 && gotvers == 0)) {
 					gotvers = vers;
+					gotminor = minorvers;
 					/* We'll take this one. */
 					ndi->nfsdi_versindex = i;
 					ndi->nfsdi_vers = vers;
@@ -5153,7 +5171,7 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 				}
 			}
 			if (gotvers == 0) {
-				printf("pNFS: no NFSv3 or NFSv4.1\n");
+				printf("pNFS: no NFSv3, NFSv4.1 or NFSv4.2\n");
 				error = NFSERR_BADXDR;
 				goto nfsmout;
 			}
@@ -5179,7 +5197,7 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 			 * NFS version and IP address.
 			 */
 			error = nfsrpc_fillsa(nmp, &ssin, &ssin6, safilled,
-			    gotvers, &dsp, p);
+			    gotvers, gotminor, &dsp, p);
 		}
 		if (error == 0) {
 			KASSERT(gotdspp != NULL, ("gotdspp is NULL"));
@@ -5408,15 +5426,15 @@ nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, str
  */
 static int
 nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin,
-    struct sockaddr_in6 *sin6, sa_family_t af, int vers, struct nfsclds **dspp,
-    NFSPROC_T *p)
+    struct sockaddr_in6 *sin6, sa_family_t af, int vers, int minorvers,
+    struct nfsclds **dspp, NFSPROC_T *p)
 {
 	struct sockaddr_in *msad, *sad;
 	struct sockaddr_in6 *msad6, *sad6;
 	struct nfsclclient *clp;
 	struct nfssockreq *nrp;
 	struct nfsclds *dsp, *tdsp;
-	int error;
+	int error, firsttry;
 	enum nfsclds_state retv;
 	uint32_t sequenceid;
 
@@ -5527,9 +5545,16 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in
 	/* Now, do the exchangeid and create session. */
 	if (error == 0) {
 		if (vers == NFS_VER4) {
-			error = nfsrpc_exchangeid(nmp, clp, nrp,
-			    NFSV4EXCH_USEPNFSDS, &dsp, nrp->nr_cred, p);
-			NFSCL_DEBUG(3, "DS exchangeid=%d\n", error);
+			firsttry = 0;
+			do {
+				error = nfsrpc_exchangeid(nmp, clp, nrp, 
+				    minorvers, NFSV4EXCH_USEPNFSDS, &dsp,
+				    nrp->nr_cred, p);
+				NFSCL_DEBUG(3, "DS exchangeid=%d\n", error);
+				if (error == NFSERR_MINORVERMISMATCH)
+					minorvers = NFSV42_MINORVERSION;
+			} while (error == NFSERR_MINORVERMISMATCH &&
+			    firsttry++ == 0);
 			if (error != 0)
 				newnfs_disconnect(nrp);
 		} else {
@@ -5569,7 +5594,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in
 				    dsp->nfsclds_sess.nfsess_sequenceid;
 			NFSUNLOCKMNT(nmp);
 			error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess,
-			    nrp, sequenceid, 0, nrp->nr_cred, p);
+			    nrp, dsp, sequenceid, 0, nrp->nr_cred, p);
 			NFSCL_DEBUG(3, "DS createsess=%d\n", error);
 		}
 	} else {
@@ -5931,7 +5956,7 @@ nfscl_findlayoutforio(struct nfscllayout *lyp, uint64_
 }
 
 /*
- * Do I/O using an NFSv4.1 file layout.
+ * Do I/O using an NFSv4.1 or NFSv4.2 file layout.
  */
 static int
 nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
@@ -5940,7 +5965,7 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i
     uint64_t len, int docommit, struct ucred *cred, NFSPROC_T *p)
 {
 	uint64_t io_off, rel_off, stripe_unit_size, transfer, xfer;
-	int commit_thru_mds, error, stripe_index, stripe_pos;
+	int commit_thru_mds, error, stripe_index, stripe_pos, minorvers;
 	struct nfsnode *np;
 	struct nfsfh *fhp;
 	struct nfsclds **dspp;
@@ -5957,6 +5982,10 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i
 	while (len > 0 && error == 0) {
 		stripe_index = nfsfldi_stripeindex(dp, stripe_pos);
 		dspp = nfsfldi_addr(dp, stripe_index);
+		if (((*dspp)->nfsclds_flags & NFSCLDS_MINORV2) != 0)
+			minorvers = NFSV42_MINORVERSION;
+		else
+			minorvers = NFSV41_MINORVERSION;
 		if (len > transfer && docommit == 0)
 			xfer = transfer;
 		else
@@ -5994,7 +6023,7 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i
 		if (docommit != 0) {
 			if (error == 0)
 				error = nfsrpc_commitds(vp, io_off, xfer,
-				    *dspp, fhp, 0, 0, cred, p);
+				    *dspp, fhp, NFS_VER4, minorvers, cred, p);
 			if (error == 0) {
 				/*
 				 * Set both eof and uio_resid = 0 to end any
@@ -6009,11 +6038,11 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *i
 			}
 		} else if (rwflag == NFSV4OPEN_ACCESSREAD)
 			error = nfsrpc_readds(vp, uiop, stateidp, eofp, *dspp,
-			    io_off, xfer, fhp, 0, 0, 0, cred, p);
+			    io_off, xfer, fhp, 0, NFS_VER4, minorvers, cred, p);
 		else {
 			error = nfsrpc_writeds(vp, uiop, iomode, must_commit,
 			    stateidp, *dspp, io_off, xfer, fhp, commit_thru_mds,
-			    0, 0, 0, cred, p);
+			    0, NFS_VER4, minorvers, cred, p);
 			if (error == 0) {
 				NFSLOCKCLSTATE();
 				lyp->nfsly_flags |= NFSLY_WRITTEN;

Modified: projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c	Mon Nov  4 06:16:00 2019	(r354329)
@@ -4077,6 +4077,8 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused 
 			clp->lc_flags |= LCL_GSSPRIVACY;
 	} else
 		clp->lc_flags = LCL_NFSV41;
+	if ((nd->nd_flag & ND_NFSV42) != 0)
+		clp->lc_flags |= LCL_NFSV42;
 	if ((nd->nd_flag & ND_GSS) != 0 && nd->nd_princlen > 0) {
 		clp->lc_flags |= LCL_NAME;
 		clp->lc_namelen = nd->nd_princlen;

Modified: projects/nfsv42/sys/fs/nfsserver/nfs_nfsdsocket.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsserver/nfs_nfsdsocket.c	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfsserver/nfs_nfsdsocket.c	Mon Nov  4 06:16:00 2019	(r354329)
@@ -412,6 +412,17 @@ int nfsrv_writerpc[NFS_NPROCS] = { 0, 0, 1, 0, 0, 0, 0
     1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
 
+SYSCTL_DECL(_vfs_nfsd);
+static int	nfs_minminorv4 = NFSV4_MINORVERSION;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_minorversion4, CTLFLAG_RWTUN,
+    &nfs_minminorv4, 0,
+    "The lowest minor version of NFSv4 handled by the server");
+
+static int	nfs_maxminorv4 = NFSV42_MINORVERSION;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_minorversion4, CTLFLAG_RWTUN,
+    &nfs_maxminorv4, 0,
+    "The highest minor version of NFSv4 handled by the server");
+
 /* local functions */
 static void nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
     u_char *tag, int taglen, u_int32_t minorvers);
@@ -796,9 +807,10 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram
 	(void) nfsm_strtom(nd, tag, taglen);
 	NFSM_BUILD(retopsp, u_int32_t *, NFSX_UNSIGNED);
 	NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
-	if (minorvers != NFSV4_MINORVERSION &&
+	if ((minorvers != NFSV4_MINORVERSION &&
 	    minorvers != NFSV41_MINORVERSION &&
-	    minorvers != NFSV42_MINORVERSION)
+	    minorvers != NFSV42_MINORVERSION) ||
+	    minorvers < nfs_minminorv4 || minorvers > nfs_maxminorv4)
 		nd->nd_repstat = NFSERR_MINORVERMISMATCH;
 	if (nd->nd_repstat)
 		numops = 0;

Modified: projects/nfsv42/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsserver/nfs_nfsdstate.c	Mon Nov  4 03:07:01 2019	(r354328)
+++ projects/nfsv42/sys/fs/nfsserver/nfs_nfsdstate.c	Mon Nov  4 06:16:00 2019	(r354329)
@@ -4454,6 +4454,8 @@ nfsrv_docallback(struct nfsclient *clp, int procnum, n
 		nd->nd_flag |= ND_KERBV;
 	if ((clp->lc_flags & LCL_NFSV41) != 0)
 		nd->nd_flag |= ND_NFSV41;
+	if ((clp->lc_flags & LCL_NFSV42) != 0)
+		nd->nd_flag |= ND_NFSV42;
 	nd->nd_repstat = 0;
 	cred->cr_uid = clp->lc_uid;
 	cred->cr_gid = clp->lc_gid;
@@ -7892,7 +7894,7 @@ nfsrv_allocdevid(struct nfsdevice *ds, char *addr, cha
 	 * as defined for Flexible File Layout) in XDR.
 	 */
 	addrlen = NFSM_RNDUP(strlen(addr)) + NFSM_RNDUP(strlen(netprot)) +
-	    9 * NFSX_UNSIGNED;
+	    14 * NFSX_UNSIGNED;
 	ds->nfsdev_flexaddrlen = addrlen;
 	tl = malloc(addrlen, M_NFSDSTATE, M_WAITOK | M_ZERO);
 	ds->nfsdev_flexaddr = (char *)tl;
@@ -7904,7 +7906,12 @@ nfsrv_allocdevid(struct nfsdevice *ds, char *addr, cha
 	*tl++ = txdr_unsigned(strlen(addr));
 	NFSBCOPY(addr, tl, strlen(addr));
 	tl += (NFSM_RNDUP(strlen(addr)) / NFSX_UNSIGNED);
-	*tl++ = txdr_unsigned(1);		/* One NFS Version. */
+	*tl++ = txdr_unsigned(2);		/* Two NFS Versions. */
+	*tl++ = txdr_unsigned(NFS_VER4);	/* NFSv4. */
+	*tl++ = txdr_unsigned(NFSV42_MINORVERSION); /* Minor version 2. */
+	*tl++ = txdr_unsigned(NFS_SRVMAXIO);	/* DS max rsize. */
+	*tl++ = txdr_unsigned(NFS_SRVMAXIO);	/* DS max wsize. */
+	*tl++ = newnfs_true;			/* Tightly coupled. */
 	*tl++ = txdr_unsigned(NFS_VER4);	/* NFSv4. */
 	*tl++ = txdr_unsigned(NFSV41_MINORVERSION); /* Minor version 1. */
 	*tl++ = txdr_unsigned(NFS_SRVMAXIO);	/* DS max rsize. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911040616.xA46G0As003265>