From owner-svn-src-projects@freebsd.org Thu Oct 3 02:59:31 2019 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8A69FCCD0 for ; Thu, 3 Oct 2019 02:59:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46kHm34SYfz4M7d; Thu, 3 Oct 2019 02:59:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 783605952; Thu, 3 Oct 2019 02:59:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x932xVaT032373; Thu, 3 Oct 2019 02:59:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x932xVtG032372; Thu, 3 Oct 2019 02:59:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201910030259.x932xVtG032372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 3 Oct 2019 02:59:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r353029 - projects/nfsv42/sys/fs/nfsserver X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfsv42/sys/fs/nfsserver X-SVN-Commit-Revision: 353029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Oct 2019 02:59:31 -0000 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)