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) From owner-svn-src-projects@freebsd.org Fri Oct 4 02:04:33 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 15D99146AA3 for ; Fri, 4 Oct 2019 02:04:33 +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 46ktV86nwnz3Hrj; Fri, 4 Oct 2019 02:04:32 +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 CDF0C1D47D; Fri, 4 Oct 2019 02:04:32 +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 x9424W0m064836; Fri, 4 Oct 2019 02:04:32 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9424Wvd064835; Fri, 4 Oct 2019 02:04:32 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201910040204.x9424Wvd064835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 4 Oct 2019 02:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r353090 - projects/nfsv42/sys/fs/nfsclient X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfsv42/sys/fs/nfsclient X-SVN-Commit-Revision: 353090 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: Fri, 04 Oct 2019 02:04:33 -0000 Author: rmacklem Date: Fri Oct 4 02:04:32 2019 New Revision: 353090 URL: https://svnweb.freebsd.org/changeset/base/353090 Log: Flush writes in the NFSv4.2 client before doing a Seek operation. For a Seek operation to work correctly on a NFSv4.2 server, the file must be up to date on the server. So, flush writes to the server before doing the Seek operation. Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 4 02:04:18 2019 (r353089) +++ projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 4 02:04:32 2019 (r353090) @@ -3700,7 +3700,7 @@ nfs_ioctl(struct vop_ioctl_args *ap) struct nfsvattr nfsva; struct nfsmount *nmp; int attrflag, content, error, ret; - bool eof; + bool eof = false; /* shut up compiler. */ if (vp->v_type != VREG) return (ENOTTY); @@ -3729,8 +3729,11 @@ nfs_ioctl(struct vop_ioctl_args *ap) if (*((off_t *)ap->a_data) >= VTONFS(vp)->n_size) error = ENXIO; else { - error = nfsrpc_seek(vp, (off_t *)ap->a_data, &eof, content, - ap->a_cred, &nfsva, &attrflag); + /* Flush all writes, so that the server is up to date. */ + error = ncl_flush(vp, MNT_WAIT, ap->a_td, 1, 0); + if (error == 0) + error = nfsrpc_seek(vp, (off_t *)ap->a_data, &eof, + content, ap->a_cred, &nfsva, &attrflag); /* If at eof for FIOSEEKDATA, return ENXIO. */ if (eof && error == 0 && content == NFSV4CONTENT_DATA) error = ENXIO; From owner-svn-src-projects@freebsd.org Fri Oct 4 04:57:37 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 1F9C5FB786 for ; Fri, 4 Oct 2019 04:57:37 +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 46kyKr75K7z3xvX; Fri, 4 Oct 2019 04:57:36 +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 D23981F3B5; Fri, 4 Oct 2019 04:57:36 +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 x944vaiu065879; Fri, 4 Oct 2019 04:57:36 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x944vaDh065878; Fri, 4 Oct 2019 04:57:36 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201910040457.x944vaDh065878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 4 Oct 2019 04:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r353097 - projects/nfsv42/sys/fs/nfsclient X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfsv42/sys/fs/nfsclient X-SVN-Commit-Revision: 353097 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: Fri, 04 Oct 2019 04:57:37 -0000 Author: rmacklem Date: Fri Oct 4 04:57:36 2019 New Revision: 353097 URL: https://svnweb.freebsd.org/changeset/base/353097 Log: Flush writes for both in and out files before NFSv4.2 Copy in client. The input file needs to be up to date on the server and the writes need to be flushed on the output file so that they don't overwrite copied data on the server. Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 4 03:55:53 2019 (r353096) +++ projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 4 04:57:36 2019 (r353097) @@ -3584,6 +3584,15 @@ nfs_copy_file_range(struct vop_copy_file_range_args *a io.uio_resid = *ap->a_lenp; error = vn_rlimit_fsize(outvp, &io, ap->a_fsizetd); + /* + * Flush all writes for both files, so they will be up to date + * on the server before doing the copy. + */ + if (error == 0) + error = ncl_flush(invp, MNT_WAIT, curthread, 1, 0); + if (error == 0) + error = ncl_flush(outvp, MNT_WAIT, curthread, 1, 0); + /* Do the actual NFSv4.2 RPC. */ len = *ap->a_lenp; mtx_lock(&nmp->nm_mtx); From owner-svn-src-projects@freebsd.org Fri Oct 4 05:02:40 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 99DE6FB9AB for ; Fri, 4 Oct 2019 05:02:40 +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 46kyRh3W9Tz3yLB; Fri, 4 Oct 2019 05:02:40 +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 5BD6B1F578; Fri, 4 Oct 2019 05:02:40 +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 x9452eq4072036; Fri, 4 Oct 2019 05:02:40 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9452eYZ072035; Fri, 4 Oct 2019 05:02:40 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201910040502.x9452eYZ072035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 4 Oct 2019 05:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r353098 - projects/nfsv42/sys/fs/nfsclient X-SVN-Group: projects X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: projects/nfsv42/sys/fs/nfsclient X-SVN-Commit-Revision: 353098 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: Fri, 04 Oct 2019 05:02:40 -0000 Author: rmacklem Date: Fri Oct 4 05:02:39 2019 New Revision: 353098 URL: https://svnweb.freebsd.org/changeset/base/353098 Log: Fix the comment in the NFSv4.2 client copy_file_range. Fix the comment so that it correctly explains why both files are flushed before doing the Copy operation. Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Modified: projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 4 04:57:36 2019 (r353097) +++ projects/nfsv42/sys/fs/nfsclient/nfs_clvnops.c Fri Oct 4 05:02:39 2019 (r353098) @@ -3585,8 +3585,9 @@ nfs_copy_file_range(struct vop_copy_file_range_args *a error = vn_rlimit_fsize(outvp, &io, ap->a_fsizetd); /* - * Flush all writes for both files, so they will be up to date - * on the server before doing the copy. + * Flush the input file so that the data is up to date before + * the copy. Flush writes for the output file so that they + * do not overwrite the data copied to the output file by the Copy. */ if (error == 0) error = ncl_flush(invp, MNT_WAIT, curthread, 1, 0);