From owner-svn-src-all@freebsd.org Sun Jul 26 23:03:42 2020 Return-Path: Delivered-To: svn-src-all@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 24FBF36F7D0; Sun, 26 Jul 2020 23:03:42 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4BFJQQ09LCz4Bly; Sun, 26 Jul 2020 23:03:42 +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 C2EA9142F5; Sun, 26 Jul 2020 23:03:41 +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 06QN3fRt009027; Sun, 26 Jul 2020 23:03:41 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06QN3f14009026; Sun, 26 Jul 2020 23:03:41 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007262303.06QN3f14009026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 26 Jul 2020 23:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363586 - head/sys/fs/nfsserver X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfsserver X-SVN-Commit-Revision: 363586 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2020 23:03:42 -0000 Author: rmacklem Date: Sun Jul 26 23:03:41 2020 New Revision: 363586 URL: https://svnweb.freebsd.org/changeset/base/363586 Log: Fix the NFS server so that it sets va_birthtime. r362490 marked that the NFSv4 attribute TimeCreate (va_birthtime) is supported, but it did not change the NFS server code to actually do it. As such, errors could occur when unrolling a tarball onto an NFSv4 mounted volume, since setting TimeCreate would fail with a NFSERR_ATTRNOTSUPP reply. This patch fixes the server so that it does TimeCreate and also makes sure that TimeCreate will not be set for a DS file for a pNFS server. A separate commit will add a check to the NFSv4 client for support of the TimeCreate attribute before attempting to set it, to avoid a problem when mounting a server that does not support the attribute. The failures will still occur for r362490 or later kernels that do not have this patch, since they indicate support for the attribute, but do not actually support the attribute. Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Sun Jul 26 22:30:55 2020 (r363585) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sun Jul 26 23:03:41 2020 (r363586) @@ -459,6 +459,7 @@ nfsvno_setattr(struct vnode *vp, struct nfsvattr *nvap { u_quad_t savsize = 0; int error, savedit; + time_t savbtime; /* * If this is an exported file system and a pNFS service is running, @@ -490,9 +491,13 @@ nfsvno_setattr(struct vnode *vp, struct nfsvattr *nvap nvap->na_vattr.va_mode != (mode_t)VNOVAL || nvap->na_vattr.va_atime.tv_sec != VNOVAL || nvap->na_vattr.va_mtime.tv_sec != VNOVAL)) { + /* Never modify birthtime on a DS file. */ + savbtime = nvap->na_vattr.va_birthtime.tv_sec; + nvap->na_vattr.va_birthtime.tv_sec = VNOVAL; /* For a pNFS server, set the attributes on the DS file. */ error = nfsrv_proxyds(vp, 0, 0, cred, p, NFSPROC_SETATTR, NULL, NULL, NULL, nvap, NULL, NULL, 0, NULL); + nvap->na_vattr.va_birthtime.tv_sec = savbtime; if (error == ENOENT) error = 0; } @@ -2914,8 +2919,7 @@ nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, str break; case NFSATTRBIT_TIMECREATE: NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME); - if (!nd->nd_repstat) - nd->nd_repstat = NFSERR_ATTRNOTSUPP; + fxdr_nfsv4time(tl, &nvap->na_btime); attrsum += NFSX_V4TIME; break; case NFSATTRBIT_TIMEMODIFYSET: