[Bug 294010] NFSv4: cp fails when restoring from a ZFS snapshot (copy_file_range issue)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 23 Mar 2026 19:14:59 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294010

            Bug ID: 294010
           Summary: NFSv4: cp fails when restoring from a ZFS snapshot
                    (copy_file_range issue)
           Product: Base System
           Version: 14.4-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: pmc@citylink.dinoex.sub.org

Background:
ZFS filesets carry a hidden .zfs directory at their toplevel. Within that
directory are the current snapsots of this fileset mounted as readonly trees.
Therfore, after one accidentally deletes a file and a suitable snapshot exists,
one might just restore the file from that snapshot:
 $ cp .../.zfs/snapshot/snapshot_X/someplace/somefile .../someplace/somefile

Problem:
Doing this on a local ZFS fileset works as expected. But doing it via NFS on a
remote ZFS fileset copies 0 byte (the empty file is created) and then reports
the error "Read-only file system".

Tests by forum members have shown only NFSv4 minor 2 is affected, the other
versions, and NFSv3 apparently work correct.
And apparently, besides 14.4, 15.0 and 16-current is also affected.

On forums popular demand this should become a bug report (sorry, Rick):
https://forums.freebsd.org/threads/nfs-read-only-does-not-allow-reading.102080/post-750701

-- 
You are receiving this mail because:
You are the assignee for the bug.