From nobody Sun Apr 12 00:47:14 2026 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 4ftX1h3d6qz6Y8ZH for ; Sun, 12 Apr 2026 00:47:20 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ftX1h1tCsz4Nqf for ; Sun, 12 Apr 2026 00:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775954840; 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=gk8RWOV16dI/Eu7b0b7kQq1R909JHpOHhPwDUv7Hsrs=; b=FnBz5RZpGsopJlJ+x5DKq6TMZHL0btYKiPm/FVmmFNswOtFc4euT89jS48OUdcG9u6+nB7 7QjBUrHUXWtFK5d5BTcSt+k2PGRuwRNrmaxNsHdYFfSNtLQ1hv96WDovji6jZB/1vhMxJl /ig8teqS984clrbI7qxmDdQ63XBjeM24z0qy+QA4dbTdAo4y9kCBnlB5cDv1mpmWK3DNSF 75aAXGJ4q7+H8uSqpFpKzf8VWSNQkIeomKxHJsNAUM0OZBMK2bc6RDMhEMEsK7cwj13iRh RPyRuWqDkY9b/pgzo96DlxNfpvWi/jNRdtVSYCymynFUoFLLGiI9qxKqUH3ibQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1775954840; a=rsa-sha256; cv=none; b=w3liiQGbY38KAS56w4AEtefH48ii+OXmyqum8e+xS1edZm5IJ2ITiq8jRESRILgXDH/5JA 0V7XNL3QNAZABWQDl8rePu0F4Mo8766tdgjK95WKksxJwOPSnq84fbvRZH4rBKKz79qaVE Uc12U7ZuxIbCxCqUEsdiEhD6Ffkxh3lfjNb/c0W3MYZNmJq+lBPkE3vlxNsRK8GkR7BBpa nrcK1pFpGwScVi49dX6rcf9vmFBZ2yec08mYGf6otdYsDeUHTwdBxmszG5fwdXRN8MiBaf bUl0M4L/l5FkiGm//f6ebu1WDm7hJiPSNBQKJnPalHZM07sc66YwOfhqBKEOUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775954840; 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=gk8RWOV16dI/Eu7b0b7kQq1R909JHpOHhPwDUv7Hsrs=; b=iz4y5G/6ahsYxf/EBVVtNMRej0r5yWHcfNyRwcTS5CMS+S6oDzkHBH9MbN/Zgf5DS0wq6c jqoJKRIiQFVhcS5p97XXyfyasgKONyVt0+KwnpR1ooIEzaYinh4D+tPg1WrlV5v0q9GJOu P0Rr/dyIJMZzTSCB7wHjIkfZMPQt+LPvaODI+HMO45//omOc/5c5kyiD2BrqFkDeVX3Slc kQnVzhkq6zrwfW9vAFcSp2DVh0I8GWKvLA23M7RstvhCmxqZcJNPLQ3tRxt9ob63qCMbEa h7FFEER5SQi4+4x9j5MUnkfYP/2LSNcc1hJlmNugJDsKZYwPsRKbC+sMitQB5Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4ftX1h10FFzvBk for ; Sun, 12 Apr 2026 00:47:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38269 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Apr 2026 00:47:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: fcec95bca38f - stable/14 - nfs_nfsdsocket.c: Allow Copy/Clone from a read-only fs 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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: fcec95bca38fb9bd3bd30b94efc4a0fe2bde3034 Auto-Submitted: auto-generated Date: Sun, 12 Apr 2026 00:47:14 +0000 Message-Id: <69daeb92.38269.5691e620@gitrepo.freebsd.org> The branch stable/14 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fcec95bca38fb9bd3bd30b94efc4a0fe2bde3034 commit fcec95bca38fb9bd3bd30b94efc4a0fe2bde3034 Author: Rick Macklem AuthorDate: 2026-03-29 21:41:36 +0000 Commit: Rick Macklem CommitDate: 2026-04-12 00:45:40 +0000 nfs_nfsdsocket.c: Allow Copy/Clone from a read-only fs For some server file system types, such as ZFS, a Copy/Clone operation can be done across file systems of the same file system type. However, without this patch, the Copy/Clone will fail with EROFS if the input file is on a read-only mounted file system. This happens because Copy/Clone will try to do a VOP_SETATTR() of atime to set the atime. This patch pretends the VOP_SETATTR() of atime worked for read-only file systems. It fixes a problem when copying files from a ZFS snapshot. PR: 294010 (cherry picked from commit b5815ee99a015c6ac118d7e9646d0c95b72e9f2d) --- sys/fs/nfsserver/nfs_nfsdserv.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 6047e6f2970e..460d08bd1da0 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -382,7 +382,7 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, int preat_ret = 1, postat_ret = 1, gcheck = 0, error = 0; int gotproxystateid; struct timespec guard = { 0, 0 }; - nfsattrbit_t attrbits, retbits; + nfsattrbit_t atimeonly, attrbits, retbits; nfsv4stateid_t stateid; NFSACL_T *aclp = NULL; struct thread *p = curthread; @@ -450,9 +450,28 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, */ if (!nd->nd_repstat) { if (NFSVNO_NOTSETSIZE(&nva)) { + /* + * For an NFSv4.2 Setattr of atime only that fails with + * EROFS, pretend the operation succeeded. This makes + * the semantics of copying files from a ZFS snapshot + * the same over NFSv4.2 as it is locally. + * Without this "hack", the copy will fail + * with EROFS unless the NFSv4.2 mount has the + * "noatime" mount option. + */ + NFSZERO_ATTRBIT(&atimeonly); + NFSSETBIT_ATTRBIT(&atimeonly, NFSATTRBIT_TIMEACCESSSET); if (NFSVNO_EXRDONLY(exp) || - (vp->v_mount->mnt_flag & MNT_RDONLY)) - nd->nd_repstat = EROFS; + (vp->v_mount->mnt_flag & MNT_RDONLY)) { + if ((nd->nd_flag & ND_NFSV42) != 0 && + NFSEQUAL_ATTRBIT(&attrbits, &atimeonly)) { + NFSCLRBIT_ATTRBIT(&attrbits, + NFSATTRBIT_TIMEACCESSSET); + NFSSETBIT_ATTRBIT(&retbits, + NFSATTRBIT_TIMEACCESSSET); + } else + nd->nd_repstat = EROFS; + } } else { if (vp->v_type != VREG) nd->nd_repstat = EINVAL;