From nobody Sat Jan 20 01:45:40 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TGzpD5cg4z57tFx; Sat, 20 Jan 2024 01:45:40 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TGzpD56C6z4brD; Sat, 20 Jan 2024 01:45:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705715140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+WUEGjV/qN5SmrztGA8x+JB0mxregcGdi62Fz27gm9U=; b=uup5XNPl5rYwt/hxh8vLVOKiKCTtgY1QBhY6xrVDqXe8S4bWKYJLfROi6/O7H9F6d9n3eg mrSNy9b7PsNecqV9XUuSFyaMkFrEP7lHCWOL64S/DMSA3bKNPAnzIEFPYo61r9h2+oD6ak AoaCG2aRFtWXcgtuq5hztcK9GYCrK7oxXs4Ssv4FlvHbk/d4APt05jvvco6L5dpZwB0Azs l4bCMgwsqHvtYiLmworD2RiwM8dirdD36YXfuqH0zw6xjKLPaCNuiarXoAh00FQQLvyT6p 01K8iWg1grZJbfp4HvuANF2HZ1CRNcMJohAKTtyMPz2E6hK2vaZ1DVh4jTVdkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705715140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+WUEGjV/qN5SmrztGA8x+JB0mxregcGdi62Fz27gm9U=; b=dhAxr0fAcdPl3hOMLn9+IrTu0aiyBMYFUkoJp87MIsFI8zAaqQlp+RQiL7ReL4Befa8+qC 0vn3TrgZFU7mI5WT1No6IkMsLYwyaVHwUQMQe/oq2LjVhViOgPBCkRDPIiBje3qIj1JxAY nPMoDCClZm+z6SFF+Nk988ro/8o1Hhws/ZBo9V16hle6d7m2b+NnsSV4U2uNXU+sfF3pfn HjRqDrYmEJyGc8+0IUyotbZ5TEyFFW/3lQ8/fSfGe3ryt1XAYD9wYOWtO2XcMTnRq3fuSc eopLzsWtWaJ2vBHQ5LZQflR/cHZ7hgQ9CwVAsbpntOXFuJWc8t3ejSPvuFtk6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705715140; a=rsa-sha256; cv=none; b=vHRNKHePKM8ZpFTenO6E5EoZXaipACbqp7vV2AkrGiAEVbec5M6IfG6WF5J1QC8VOo6zUe LgGRe4dSuO7y3uBMlE7aTzmYEg+KqbSoyrBpV6b/+5hkIeWiW77tCBwlmit1ra6Gnr16FK hpdVQjo0Uy54b3OwgHbjG4k/Ny5Jzfix7ls8x0fC9cW875GixaBndhFkeXa5p1uXRA+q7c 7c0dgrc1NpgzOns9/loZiy77rbpL9+WlgFOe/Aw/PRL5XiVPoyPPBDlPylZLlwdNcaXZ2f F6XBa3hq85cIrEC8EpxPy+sVaD75yoEShUO56ChqdgVaaQcZRVWrDjW9JnQ8CA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TGzpD3sq9zFqn; Sat, 20 Jan 2024 01:45:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40K1jenr055049; Sat, 20 Jan 2024 01:45:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40K1jeXX055046; Sat, 20 Jan 2024 01:45:40 GMT (envelope-from git) Date: Sat, 20 Jan 2024 01:45:40 GMT Message-Id: <202401200145.40K1jeXX055046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: d34f4baaf138 - stable/14 - nfscl: Only update atime for Copy when noatime is not specified List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d34f4baaf13802759869d5ad341a4ca806b2f0fe Auto-Submitted: auto-generated The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d34f4baaf13802759869d5ad341a4ca806b2f0fe commit d34f4baaf13802759869d5ad341a4ca806b2f0fe Author: Rick Macklem AuthorDate: 2024-01-12 00:38:33 +0000 Commit: Rick Macklem CommitDate: 2024-01-20 01:44:23 +0000 nfscl: Only update atime for Copy when noatime is not specified Commit 57ce37f9dcd0 modified the NFSv4.2 Copy operation so that it will update atime on the infd file whenever possible. This is done by adding a Setattr of TimeAccess for the input file. This patch disables this change for the case of an NFSv4.2 mount with the "noatime" mount option, which avoids the additional Setattr of TimeAccess operation. (cherry picked from commit cc760de2183f9c9a4099783d3ff4c770521a4cb6) --- sys/fs/nfs/nfs_commonsubs.c | 2 +- sys/fs/nfsclient/nfs_clrpcops.c | 28 +++++++++++++++++----------- sys/fs/nfsclient/nfs_clvnops.c | 28 ++++++++++++++++------------ 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 832713e6c1de..f2305795e53e 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -296,7 +296,7 @@ static struct { { NFSV4OP_OPEN, 8, "CreateLayGet", 12, }, { NFSV4OP_IOADVISE, 1, "Advise", 6, }, { NFSV4OP_ALLOCATE, 2, "Allocate", 8, }, - { NFSV4OP_SAVEFH, 6, "Copy", 4, }, + { NFSV4OP_SAVEFH, 5, "Copy", 4, }, { NFSV4OP_SEEK, 2, "Seek", 4, }, { NFSV4OP_SEEK, 1, "SeekDS", 6, }, { NFSV4OP_GETXATTR, 2, "Getxattr", 8, }, diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index e9acedfb6473..09660730d485 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -8728,7 +8728,7 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, int *outattrflagp, bool consecutive, int *commitp, struct ucred *cred, NFSPROC_T *p) { - uint32_t *tl; + uint32_t *tl, *opcntp; int error; struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; @@ -8737,14 +8737,15 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, struct vattr va; uint64_t len; - nmp = VFSTONFS(outvp->v_mount); + nmp = VFSTONFS(invp->v_mount); *inattrflagp = *outattrflagp = 0; *commitp = NFSWRITE_UNSTABLE; len = *lenp; *lenp = 0; if (len > nfs_maxcopyrange) len = nfs_maxcopyrange; - NFSCL_REQSTART(nd, NFSPROC_COPY, invp, cred); + nfscl_reqstart(nd, NFSPROC_COPY, nmp, VTONFS(invp)->n_fhp->nfh_fh, + VTONFS(invp)->n_fhp->nfh_len, &opcntp, NULL, 0, 0, cred); /* * First do a Setattr of atime to the server's clock * time. The FreeBSD "collective" was of the opinion @@ -8753,13 +8754,17 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, * handled well if the server replies NFSERR_DELAY to * the Setattr operation. */ - NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); - *tl = txdr_unsigned(NFSV4OP_SETATTR); - nfsm_stateidtom(nd, instateidp, NFSSTATEID_PUTSTATEID); - VATTR_NULL(&va); - va.va_atime.tv_sec = va.va_atime.tv_nsec = 0; - va.va_vaflags = VA_UTIMES_NULL; - nfscl_fillsattr(nd, &va, invp, 0, 0); + if ((nmp->nm_mountp->mnt_flag & MNT_NOATIME) == 0) { + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_SETATTR); + nfsm_stateidtom(nd, instateidp, NFSSTATEID_PUTSTATEID); + VATTR_NULL(&va); + va.va_atime.tv_sec = va.va_atime.tv_nsec = 0; + va.va_vaflags = VA_UTIMES_NULL; + nfscl_fillsattr(nd, &va, invp, 0, 0); + /* Bump opcnt from 7 to 8. */ + *opcntp = txdr_unsigned(8); + } /* Now Getattr the invp attributes. */ NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); @@ -8798,7 +8803,8 @@ nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outvp, off_t outoff, if (error != 0) return (error); /* Skip over the Setattr reply. */ - if ((nd->nd_flag & ND_NOMOREDATA) == 0) { + if ((nd->nd_flag & ND_NOMOREDATA) == 0 && + (nmp->nm_mountp->mnt_flag & MNT_NOATIME) == 0) { NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); if (*(tl + 1) == 0) { error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 0014f8a26d20..0b8c587a542c 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3934,18 +3934,22 @@ relock: */ if (inoff >= vap->va_size) { *ap->a_lenp = len = 0; - VATTR_NULL(&va); - va.va_atime.tv_sec = va.va_atime.tv_nsec = 0; - va.va_vaflags = VA_UTIMES_NULL; - inattrflag = 0; - error = nfsrpc_setattr(invp, &va, NULL, - ap->a_incred, curthread, &innfsva, - &inattrflag); - if (inattrflag != 0) - ret = nfscl_loadattrcache(&invp, - &innfsva, NULL, 0, 1); - if (error == 0 && ret != 0) - error = ret; + if ((nmp->nm_mountp->mnt_flag & MNT_NOATIME) == + 0) { + VATTR_NULL(&va); + va.va_atime.tv_sec = 0; + va.va_atime.tv_nsec = 0; + va.va_vaflags = VA_UTIMES_NULL; + inattrflag = 0; + error = nfsrpc_setattr(invp, &va, NULL, + ap->a_incred, curthread, &innfsva, + &inattrflag); + if (inattrflag != 0) + ret = nfscl_loadattrcache(&invp, + &innfsva, NULL, 0, 1); + if (error == 0 && ret != 0) + error = ret; + } } else if (inoff + len > vap->va_size) *ap->a_lenp = len = vap->va_size - inoff; } else