Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2018 02:48:11 +0000
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        NAGY Andreas <Andreas.Nagy@frequentis.com>, "'freebsd-stable@freebsd.org'" <freebsd-stable@freebsd.org>
Subject:   =?iso-8859-1?Q?Re:_NFS_4.1_RECLAIM=5FCOMPLETE_FS=A0failed_error_in_combin?= =?iso-8859-1?Q?ation_with_ESXi_client?=
Message-ID:  <YQBPR0101MB1042B17763E2605A7CE72EF5DDDF0@YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM>
In-Reply-To: <D890568E1D8DD044AA846C56245166780124AFCABC@vie196nt>
References:  <c5c624de-42bb-45cf-8cf0-b25be56e5f58@frequentis.com> <YQBPR0101MB1042DEF0825996764CBCA829DDC40@YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM>, <D890568E1D8DD044AA846C56245166780124AFB90E@vie196nt> <YQBPR0101MB1042479407CAA253674BBAEBDDDB0@YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM> <D890568E1D8DD044AA846C56245166780124AFBD21@vie196nt>, <D890568E1D8DD044AA846C56245166780124AFBD91@vie196nt> <YQBPR0101MB104225B6884FEC70A03C61CCDDDA0@YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM>, <D890568E1D8DD044AA846C56245166780124AFC0E2@vie196nt>, <YQBPR0101MB1042040D2BFB3681E940D271DDDA0@YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM>, <2feda1e2-16d5-43b5-98eb-dcc71cc67c6f@frequentis.com> <YQBPR0101MB10427C97161C74A5C441D1DCDDD80@YQBPR0101MB1042.CANPRD01.PROD.OUTLOOK.COM>, <D890568E1D8DD044AA846C56245166780124AFCABC@vie196nt>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
NAGY Andreas wrote:
>attached the trace. If I see it correct it uses FORE_OR_BOTH. (bctsa_dir: >CDFC4_FORE_OR_BOTH (0x00000003))
Yes. The scary part is the ExchangeID before the BindConnectiontoSession.
(Normally that is only done at the beginning of a new mount to get a ClientID,
 followed immediately by a CreateSession. I don't know why it would do this?)

The attached patch might get BindConnectiontoSession to work. I have no way
to test it beyond seeing it compile. Hopefully it will apply cleanly.

>The trace is only with the first patch, have not compiled the wantdeleg patches so >far.
That's fine. I don't think that matters much.

>I think this is related to the BIND_CONN_TO_SESSION; after a disconnect the ESXi >cannot connect to the NFS also with this warning:
>2018-03-07T16:55:11.227Z cpu21:66484)WARNING: NFS41: NFS41_Bug:2361: >BUG - Invalid BIND_CONN_TO_SESSION error: NFS4ERR_NOTSUPP
If the attached patch works, you'll find out what it fixes.

>Another thing I noticed today is that it is not possible to delete a folder with the >ESXi datastorebrowser on the NFS mount. Maybe it is a VMWare bug, but with >NFS3 it works.
>
>Here the vmkernel.log with only one connection contains mounting, trying to >delete a folder and disconnect:
>
>2018-03-07T16:46:04.543Z cpu12:68008 opID=55bea165)World: 12235: VC opID >c55dbe59 maps to vmkernel opID 55bea165
>2018-03-07T16:46:04.543Z cpu12:68008 opID=55bea165)NFS41: >NFS41_VSIMountSet:423: Mount server: 10.0.0.225, port: 2049, path: /, label: >nfsds1, security: 1 user: , options: <none>
>2018-03-07T16:46:04.543Z cpu12:68008 opID=55bea165)StorageApdHandler: >977: APD Handle  Created with lock[StorageApd-0x43046e4c6d70]
>2018-03-07T16:46:04.544Z cpu11:66486)NFS41: >NFS41ProcessClusterProbeResult:3873: Reclaiming state, cluster 0x43046e4c7ee0 >[7]
>2018-03-07T16:46:04.545Z cpu12:68008 opID=55bea165)NFS41: >NFS41FSCompleteMount:3791: Lease time: 120
>2018-03-07T16:46:04.545Z cpu12:68008 opID=55bea165)NFS41: >NFS41FSCompleteMount:3792: Max read xfer size: 0x20000
>2018-03-07T16:46:04.545Z cpu12:68008 opID=55bea165)NFS41: >NFS41FSCompleteMount:3793: Max write xfer size: 0x20000
>2018-03-07T16:46:04.545Z cpu12:68008 opID=55bea165)NFS41: >NFS41FSCompleteMount:3794: Max file size: 0x800000000000
>2018-03-07T16:46:04.545Z cpu12:68008 opID=55bea165)NFS41: >NFS41FSCompleteMount:3795: Max file name: 255
>2018-03-07T16:46:04.545Z cpu12:68008 opID=55bea165)WARNING: NFS41: >NFS41FSCompleteMount:3800: The max file name size (255) of file system is >larger than that of FSS (128)
>2018-03-07T16:46:04.546Z cpu12:68008 opID=55bea165)NFS41: >NFS41FSAPDNotify:5960: Restored connection to the server 10.0.0.225 mount >point nfsds1, mounted as 1a7893c8-eec764a7-0000-000000000000 ("/")
>2018-03-07T16:46:04.546Z cpu12:68008 opID=55bea165)NFS41: >NFS41_VSIMountSet:435: nfsds1 mounted successfully
>2018-03-07T16:47:19.869Z cpu21:67981 opID=e47706ec)World: 12235: VC opID >c55dbe91 maps to vmkernel opID e47706ec
>2018-03-07T16:47:19.869Z cpu21:67981 opID=e47706ec)WARNING: NFS41: >NFS41FileOpReaddir:4728: Failed to process READDIR result for fh 0x43046e4c6
I have no idea if getting BindConnectiontoSession working will fix this or not?

rick


[-- Attachment #2 --]
--- fs/nfs/nfs_commonsubs.c.sav	2018-03-07 20:40:48.321467000 -0500
+++ fs/nfs/nfs_commonsubs.c	2018-03-07 20:41:24.691182000 -0500
@@ -131,7 +131,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_
 	{ 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 },		/* Write */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 },		/* ReleaseLockOwner */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Backchannel Ctrl */
-	{ 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 },		/* Bind Conn to Sess */
+	{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 },		/* Bind Conn to Sess */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 },		/* Exchange ID */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 },		/* Create Session */
 	{ 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 },		/* Destroy Session */
--- fs/nfs/nfs_var.h.sav	2018-03-07 21:14:57.576474000 -0500
+++ fs/nfs/nfs_var.h	2018-03-07 21:16:54.597802000 -0500
@@ -95,6 +95,7 @@ int nfsrv_getclient(nfsquad_t, int, stru
     nfsquad_t, uint32_t, struct nfsrv_descript *, NFSPROC_T *);
 int nfsrv_destroyclient(nfsquad_t, NFSPROC_T *);
 int nfsrv_destroysession(struct nfsrv_descript *, uint8_t *);
+int nfsrv_bindconnsess(uint8_t *, int *);
 int nfsrv_freestateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *);
 int nfsrv_adminrevoke(struct nfsd_clid *, NFSPROC_T *);
 void nfsrv_dumpclients(struct nfsd_dumpclients *, int);
@@ -230,6 +231,8 @@ int nfsrvd_reclaimcomplete(struct nfsrv_
     vnode_t, NFSPROC_T *, struct nfsexstuff *);
 int nfsrvd_destroyclientid(struct nfsrv_descript *, int,
     vnode_t, NFSPROC_T *, struct nfsexstuff *);
+int nfsrvd_bindconnsess(struct nfsrv_descript *, int,
+    vnode_t, NFSPROC_T *, struct nfsexstuff *);
 int nfsrvd_destroysession(struct nfsrv_descript *, int,
     vnode_t, NFSPROC_T *, struct nfsexstuff *);
 int nfsrvd_freestateid(struct nfsrv_descript *, int,
--- fs/nfs/nfsproto.h.sav	2018-03-07 21:32:38.706155000 -0500
+++ fs/nfs/nfsproto.h	2018-03-07 21:38:13.053734000 -0500
@@ -648,6 +648,15 @@
 #define	NFSFLAYUTIL_DENSE		0x1
 #define	NFSFLAYUTIL_COMMIT_THRU_MDS	0x2
 
+/* Enum values for Bind Connection to Session. */
+#define	NFSCDFC4_FORE		0x1
+#define	NFSCDFC4_BACK		0x2
+#define	NFSCDFC4_FORE_OR_BOTH	0x3
+#define	NFSCDFC4_BACK_OR_BOTH	0x7
+#define	NFSCDFS4_FORE		0x1
+#define	NFSCDFS4_BACK		0x2
+#define	NFSCDFS4_BOTH		0x3
+
 /* Conversion macros */
 #define	vtonfsv2_mode(t,m) 						\
 		txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : 	\
--- fs/nfsserver/nfs_nfsdserv.c.sav	2018-03-07 20:42:20.347017000 -0500
+++ fs/nfsserver/nfs_nfsdserv.c	2018-03-07 21:43:33.067606000 -0500
@@ -4041,6 +4041,45 @@ nfsmout:
 }
 
 /*
+ * nfsv4 bind connection to session service
+ */
+APPLESTATIC int
+nfsrvd_bindconnsess(struct nfsrv_descript *nd, __unused int isdgram,
+    __unused vnode_t vp, NFSPROC_T *p, __unused struct nfsexstuff *exp)
+{
+	uint32_t *tl;
+	uint8_t sessid[NFSX_V4SESSIONID];
+	int error = 0, foreaft;
+
+	if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
+		nd->nd_repstat = NFSERR_WRONGSEC;
+		goto nfsmout;
+	}
+	NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED);
+	NFSBCOPY(tl, sessid, NFSX_V4SESSIONID);
+	tl += (NFSX_V4SESSIONID / NFSX_UNSIGNED);
+	foreaft = fxdr_unsigned(int, *tl++);
+	if (*tl == newnfs_true) {
+		/* RDMA is not supported. */
+		nd->nd_repstat = NFSERR_NOTSUPP;
+		goto nfsmout;
+	}
+
+	nd->nd_repstat = nfsrv_bindconnsess(sessid, &foreaft);
+	if (nd->nd_repstat == 0) {
+		NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 *
+		    NFSX_UNSIGNED);
+		NFSBCOPY(sessid, tl, NFSX_V4SESSIONID);
+		tl += (NFSX_V4SESSIONID / NFSX_UNSIGNED);
+		*tl++ = txdr_unsigned(foreaft);
+		*tl = newnfs_false;
+	}
+nfsmout:
+	NFSEXITCODE2(error, nd);
+	return (error);
+}
+
+/*
  * nfsv4 destroy session service
  */
 APPLESTATIC int
--- fs/nfsserver/nfs_nfsdsocket.c.sav	2018-03-07 21:12:50.052562000 -0500
+++ fs/nfsserver/nfs_nfsdsocket.c	2018-03-07 21:14:21.247331000 -0500
@@ -176,7 +176,7 @@ int (*nfsrv4_ops0[NFSV41_NOPS])(struct n
 	nfsrvd_write,
 	nfsrvd_releaselckown,
 	nfsrvd_notsupp,
-	nfsrvd_notsupp,
+	nfsrvd_bindconnsess,
 	nfsrvd_exchangeid,
 	nfsrvd_createsession,
 	nfsrvd_destroysession,
--- fs/nfsserver/nfs_nfsdstate.c.sav	2018-03-07 21:17:08.050132000 -0500
+++ fs/nfsserver/nfs_nfsdstate.c	2018-03-07 21:39:29.296950000 -0500
@@ -5950,6 +5950,44 @@ nfsrv_destroysession(struct nfsrv_descri
 }
 
 /*
+ * Bind a connection to a session.
+ * For now, only certain variants are supported, since the current session
+ * structure can only handle a single backchannel entry, which will be
+ * applied to all connections if it is set.
+ */
+int
+nfsrv_bindconnsess(uint8_t *sessionid, int *foreaftp)
+{
+	struct nfssessionhash *shp;
+	struct nfsdsession *sep;
+	int error;
+
+	error = 0;
+	shp = NFSSESSIONHASH(sessionid);
+	NFSLOCKSESSION(shp);
+	sep = nfsrv_findsession(sessionid);
+	if (sep != NULL) {
+		if ((sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0) {
+			/* Can only handle backchannel cases. */
+			if (*foreaftp == NFSCDFC4_FORE_OR_BOTH ||
+			    *foreaftp == NFSCDFC4_BACK_OR_BOTH)
+				*foreaftp = NFSCDFS4_BOTH;
+			else
+				error = NFSERR_NOTSUPP;
+		} else {
+			if (*foreaftp == NFSCDFC4_FORE ||
+			    *foreaftp == NFSCDFC4_FORE_OR_BOTH)
+				*foreaftp = NFSCDFS4_FORE;
+			else
+				error = NFSERR_NOTSUPP;
+		}
+	} else
+		error = NFSERR_NOTSUPP;
+	NFSUNLOCKSESSION(shp);
+	return (error);
+}
+
+/*
  * Free up a session structure.
  */
 static int
home | help

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