From nobody Sun Apr 12 00:38:43 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 4ftWqr70LMz6Y7yv for ; Sun, 12 Apr 2026 00:38:48 +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 4ftWqr6MNvz4Mjy for ; Sun, 12 Apr 2026 00:38:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775954328; 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=jxqJu2DdL6hr2rP0bk6sw3ybdpDUFnK3/TVzApJf+8U=; b=xfGqdFxpu8LGFT9YuE42za2btuD4yNZDv1BueBJoVqYvMdNBfN1Iqc5Ep9NcO7YPoTe140 19mnqoXSfait0Jjf/fSB22bm39584lPuYb572KKfCx5PPAzZxNDJobD+ds81AKFXgkdmkA VGOIbNRnBKxAKBSnx/ly3Qj1HhIdE4cqTyb76sUxUZMh4ujAA/wjScwI3b+XCBCgjdc5Js rbQ4Psakr0ZYpAPgj+Q9DRu70MMqS2/UP+yWKlKOFQJuI7lPlZHXMnFTyyoKu7kmxYQKng VlQS8zWdoKn6haXF06H8abaiGaa2Hb09/uzXwzGzM8JW1HrF22nNtJn4qZHp6g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1775954328; a=rsa-sha256; cv=none; b=hwuID87pepAo3rLemaWzxfoTCOIKCNNDPMF3EuGTOuD4cXkaYwxBzAS1Vnlpf8ZZeT7C3E cF0OveVWf3ACIxzrl47fjMbEdrM6Eop0VeddyBLFbNsjkPDFasnsPnBe4lQCF+NjJS84W0 yyEEgDE6Xq+PQEooL8v6yQPz2Oyt2nACuEswpu84DVK/ipI7R/9apDaOLjiaCUPcuzIJci PKgc/+pjOTazIRA7v0RB41t372bRtHdlLItZQFjbVLS4kxPV6zv9NXROwUg686JZ64nFU1 3fi0uFrtHuK0hCNLyGYWUrG3sJN8bQ675xrR5Gkzbw3L67vC/zJ8Ho+UWiZuog== 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=1775954328; 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=jxqJu2DdL6hr2rP0bk6sw3ybdpDUFnK3/TVzApJf+8U=; b=JGdrkSaO2o4/6CcSe9nIR4mxlWRRppiSg+LAWGeDrE/kbkVMhilyJotcAqB5lUnhNV44Jd BAluMqfSgjAHoqX/bkC89MuBCReGbH9/aGMFkWl+KNM4gviITvinplJ9qYzusUtcGe+hUR TcDsvNDtnEVBsfHvzymxXwMwNuFEHyy8ma/P9kga02YQzVAoCMHFgMdv2hv2sCHGR38FgD Muk1GhTxJH+HJJXF8DZzZCUrJjtxLG0msLgm3hBuj8ZgRrIvXqa4EbJja3dCbM4o2OPABe 9Wsn2o1ZXzVWxcJrwKfmsm1ytVmJmcdHGleg4RnTMGmz/sX+Y/phbE+lEdviFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4ftWqr5b3kztWm for ; Sun, 12 Apr 2026 00:38:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37f67 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Apr 2026 00:38:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 4beef6a4c567 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 4beef6a4c5676249c6e87de5354938d5b15dbd88 Auto-Submitted: auto-generated Date: Sun, 12 Apr 2026 00:38:43 +0000 Message-Id: <69dae993.37f67.4315677e@gitrepo.freebsd.org> The branch stable/15 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=4beef6a4c5676249c6e87de5354938d5b15dbd88 commit 4beef6a4c5676249c6e87de5354938d5b15dbd88 Author: Rick Macklem AuthorDate: 2026-03-29 21:41:36 +0000 Commit: Rick Macklem CommitDate: 2026-04-12 00:36:51 +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 bf0f638c52bb..55bf56c4daf1 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -407,7 +407,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, *daclp = NULL; struct thread *p = curthread; @@ -481,9 +481,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;