From nobody Sun Mar 29 21:43:08 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 4fkSYF1SHpz6XSHK for ; Sun, 29 Mar 2026 21:43:13 +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 4fkSY80h8Mz44NG for ; Sun, 29 Mar 2026 21:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774820588; 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=dK+UDsBZcMjK9D4VUVNp47NPLrcxMDWj8qb14Aan9WU=; b=kDQqmv4ENSoeMg8NH9QfPoMLSES7fQP77wJ7TnnfNDjcnoPp0BAxgxOGxsABP83+tu/11J zq5pSNfS/jHn8uEDmrNgrNBal53JKlm4MvSack6cRZrcBRJ5adwkB8DK+n+SAq/h65Bnnw WBcSJ+APj5/SnmTC3JnIq8xRD/2K0KWNBHNrtvsDnUts5HADjUxbFNx7Xp22bjrO0V8Z5G sx0ySRqapMAFpEcslQG+GNtXMUKGaGiJbszZmR8Rc9JzFWPudlKoOeIoCtnvSLI8EgeZxb AeMctJjei42u+RLNbP7UxBqoHz6gvSe8JNJ01iakR88WvXEyUX946+eZkqxNnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1774820588; a=rsa-sha256; cv=none; b=KaaZXfOeHtCJoXmiZuFWVi9+5KFH6+U/PwSs7L4PIfn3MavUEbb8a7rWFjFoJNVE+N0M0k uUkUsoeaMTPy4eWi/SiGjdLV/jOxodPPiZYcj03hUjc43p6VDCYFOF0fHkZjB4vGmQ7RaT Ebrif4aydwUn4vA4OJiTP7P1YO1zsYDk1FGpvM7Hl9zQP129Z2O5Pm+2OMHRDQajXtuzhU 1arCSeQguB9hTcuucFqPMJvj3QMvYbyF27ao3HqWM6zRaIr2Iu8BuqlRx99P67sL4ntds2 6K+LswEam7AKAmaIIXCqAz8Y3grvZezQ1jMSAcuaCqFK6aLQggOnZOkxzgPa0g== 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=1774820588; 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=dK+UDsBZcMjK9D4VUVNp47NPLrcxMDWj8qb14Aan9WU=; b=ldvYcwVpDjVubm0MJ/vuvNGU5JngbgtPD06ul8gxigRz/URTzcjaacvPAwsvYR8Qaw/7uL sASQ6Xun1eSmNA5UedsMfAYcUHq603UnRxE/68C/GJ8wZ2Ud/pfPG0hQ6E+HyLlqK7T7NJ ODzGLg4HlQoV60tBlaICmZj2zqjPa6S/XcQU5EGCK7RzmPWuQB+TeG/fXrt34mzEkK8Rm6 L/kz6v5qC8/wztd96nxO4xQEQmFw2vBcL2yOi47JNYOXDUQciMsVonTOceQbUYwQ0xJhAF VXxKqtyqjsKeBOjy0PCNbSqOIB+dQY056uMQrgiw1cYV9smTD3Ug3ANCyDzK5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fkSY804j0z9h for ; Sun, 29 Mar 2026 21:43:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32c7b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 29 Mar 2026 21:43:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: b5815ee99a01 - main - 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/main X-Git-Reftype: branch X-Git-Commit: b5815ee99a015c6ac118d7e9646d0c95b72e9f2d Auto-Submitted: auto-generated Date: Sun, 29 Mar 2026 21:43:08 +0000 Message-Id: <69c99cec.32c7b.33da81b7@gitrepo.freebsd.org> The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b5815ee99a015c6ac118d7e9646d0c95b72e9f2d commit b5815ee99a015c6ac118d7e9646d0c95b72e9f2d Author: Rick Macklem AuthorDate: 2026-03-29 21:41:36 +0000 Commit: Rick Macklem CommitDate: 2026-03-29 21:41:36 +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 MFC after: 2 weeks --- 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 b5c7f4743be0..601d536d2456 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;