svn commit: r353029 - projects/nfsv42/sys/fs/nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Thu Oct 3 02:59:31 UTC 2019
Author: rmacklem
Date: Thu Oct 3 02:59:30 2019
New Revision: 353029
URL: https://svnweb.freebsd.org/changeset/base/353029
Log:
Add vfs.nfsd.linuxseekdata so that the NFSv4.2 server can be Linux compatible.
Most seem to agree that RFC-7862 states that when a Seek operation with
CONTENT_DATA (SEEK_DATA) is received with an offset == file_size
(or at EOF, if you prefer), that the server should reply NFS_OK with
that offset and eof == true.
However, this breaks the Linux NFSv4.2 client, which expects NFSERR_INVAL
to be replied for this case.
When this sysctl is set non-zero, the server will now reply NFSERR_INVAL
to be Linux compatible. Since the FreeBSD client will handle either reply
correctly and Linux is the only other extant NFSv4.2 client I know of,
this sysctl is enabled by default.
Modified:
projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c
Modified: projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c Thu Oct 3 02:51:48 2019 (r353028)
+++ projects/nfsv42/sys/fs/nfsserver/nfs_nfsdserv.c Thu Oct 3 02:59:30 2019 (r353029)
@@ -77,6 +77,9 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, async, CTLFLAG_RW, &nf
extern int nfsrv_doflexfile;
SYSCTL_INT(_vfs_nfsd, OID_AUTO, default_flexfile, CTLFLAG_RW,
&nfsrv_doflexfile, 0, "Make Flex File Layout the default for pNFS");
+static int nfsrv_linuxseekdata = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, linuxseekdata, CTLFLAG_RW,
+ &nfsrv_linuxseekdata, 0, "Return EINVAL for SEEK_DATA at EOF");
/*
* This list defines the GSS mechanisms supported.
@@ -5450,6 +5453,9 @@ nfsrvd_seek(struct nfsrv_descript *nd, __unused int is
nd->nd_repstat = nfsvno_seek(nd, vp, cmd, &off, content, &eof,
nd->nd_cred, curthread);
vrele(vp);
+ if (nd->nd_repstat == 0 && eof && content == NFSV4CONTENT_DATA &&
+ nfsrv_linuxseekdata != 0)
+ nd->nd_repstat = NFSERR_INVAL;
if (nd->nd_repstat == 0) {
NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED + NFSX_HYPER);
if (eof)
More information about the svn-src-projects
mailing list