Our CI uses this script to quickly setup a FreeBSD NFSv4.1 server for testing. The script worked with FreeBSD 14.2, but with FreeBSD 15.0 all files are suddenly read-only (write access gets EPERM): sysrc rpcbind_enable="YES" sysrc mountd_enable="YES" sysrc nfs_server_enable=YES sysrc nfsv4_server_enable=YES sysrc nfsuserd_flags="-domain GLOBAL.LOC" sysrc nfsuserd_enable=YES sysrc nfscbd_enable=YES printf 'vfs.nfs.enable_uidtostring=0\n' >>'/etc/sysctl.conf' printf 'vfs.nfsd.enable_stringtouid=0\n' >>'/etc/sysctl.conf' printf 'vfs.nfsd.issue_delegations=1\n' >>'/etc/sysctl.conf' mkdir /nfsdata chmod a+rwxt /nfsdata printf 'V4: /\n' >'/etc/exports' printf '/nfsdata -network=80.247.17.0 -mask=255.255.255.0 -sec=sys\n' >>'/etc/exports' service nfsd start The failed NFS4.2 op looks like this in wireshark: Network File System, Ops(8): SEQUENCE, PUTFH, SAVEFH, OPEN, GETFH, GETATTR, RESTOREFH, GETATTR [Program Version: 4] [V4 Procedure: COMPOUND (1)] Tag: open minorversion: 2 Operations (count: 8): SEQUENCE, PUTFH, SAVEFH, OPEN, GETFH, GETATTR, RESTOREFH, GETATTR Opcode: SEQUENCE (53) Opcode: PUTFH (22) Opcode: SAVEFH (32) Opcode: OPEN (18) seqid: 0x00000000 share_access: OPEN4_SHARE_ACCESS_WRITE (2) share_deny: OPEN4_SHARE_DENY_NONE (0) clientid: 0x0000000000000000 owner: <DATA> Open Type: OPEN4_CREATE (1) Create Mode: UNCHECKED4 (0) Attr mask[0]: 0x02000010 (Size, Hidden) reqd_attr: Size (4) size: 0 reco_attr: Hidden (25) fattr4_hidden: No Attr mask[1]: 0x00004002 (Mode, System) reco_attr: Mode (33) mode: 0644, Name: Unknown, Read permission for owner, Write permission for owner, Read permission for group, Read permission for others reco_attr: System (46) fattr4_system: No Claim Type: CLAIM_NULL (0) Name: u length: 1 contents: u fill bytes: opaque data Opcode: GETFH (10) Opcode: GETATTR (9) Opcode: RESTOREFH (31) Opcode: GETATTR (9) [Main Opcode: OPEN (18)] Based on comments in freebsd-hackers@ this is an issue with ZFS, see https://lists.freebsd.org/archives/freebsd-hackers/2026-January/005476.html
Created attachment 266952 [details] Fix for NFSv4.n client specifying hidden/system during file creation The problem seems to be caused by ZFS calling secpolicy_xvattr() when any va_flags bit (which includes UF_HIDDEN and UF_SYSTEM) is specified for VOP_CREATE(). specpolicy_xvattr() returns EPERM for non-root, which is good, because if the code is patched to allow it, ZFS panics. This patch avoids the problem by disabling the va_flags field for VOP_CREATE() and then setting the va_flags bits via VOP_SETATTR() after the VOP_CREATE(), for the NFSv4.n server.
Comment on attachment 266952 [details] Fix for NFSv4.n client specifying hidden/system during file creation The patch seems to work with our JAVA NFSv4.2 client.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=a6d57f312f18bbeeda8a34e99d0a662b0db9a190 commit a6d57f312f18bbeeda8a34e99d0a662b0db9a190 Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2026-01-08 16:27:32 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2026-01-08 16:27:32 +0000 nfsd: Fix handling of hidden/system during Open/Create When an NFSv4.n client specifies settings for the archive, hidden and/or system attributes during a Open/Create, the Open/Create fails for ZFS. This is caused by ZFS doing a secpolicy_xvattr() call, which fails for non-root. If this check is bypassed, ZFS panics. This patch resolves the problem by disabling va_flags for the VOP_CREATE() call in the NFSv4.n server and then setting the flags with a subsequent VOP_SETATTR(). This problem only affects FreeBSD-15 and main, since the archive, system and hidden attributes are not enabled for FreeBSD-14. I think a similar problem exists for the NFSv4.n Open/Create/Exclusive_41, but that will be resolved in a future commit. Note that the Linux, Solaris and FreeBSD clients do not set archive, hidden or system for Open/Create, so the bug does not affect mounts from those clients. PR: 292283 Reported by: Aurelien Couderc <aurelien.couderc2002@gmail.com> Tested by: Aurelien Couderc <aurelien.couderc2002@gmail.com> MFC after: 2 weeks sys/fs/nfsserver/nfs_nfsdport.c | 11 +++++++++++ sys/fs/nfsserver/nfs_nfsdsubs.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
The patch has been committed to main and will be MFC'd.
(In reply to Rick Macklem from comment #4) Is there a FreeBSD 15 "testing" repro which can be used to update a stock FreeBSD 15.0 installation to include this fix?
(In reply to commit-hook from comment #3) Thank you!
(In reply to Rick Macklem from comment #1) Could you please file a bug report against ZFS, and post the bug report URL here for reference?
(In reply to Aurélien Couderc from comment #5) In 2 weeks, the patch will be merged from current (MFC) to stable/15, which is what 15.n is branched from. I think you could call stable/15 a testing branch for 15.n.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6fd7e55c94134b01c6e0f14f53d3172f18ab786f commit 6fd7e55c94134b01c6e0f14f53d3172f18ab786f Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2026-01-08 16:27:32 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2026-01-24 00:43:05 +0000 nfsd: Fix handling of hidden/system during Open/Create When an NFSv4.n client specifies settings for the archive, hidden and/or system attributes during a Open/Create, the Open/Create fails for ZFS. This is caused by ZFS doing a secpolicy_xvattr() call, which fails for non-root. If this check is bypassed, ZFS panics. This patch resolves the problem by disabling va_flags for the VOP_CREATE() call in the NFSv4.n server and then setting the flags with a subsequent VOP_SETATTR(). This problem only affects FreeBSD-15 and main, since the archive, system and hidden attributes are not enabled for FreeBSD-14. I think a similar problem exists for the NFSv4.n Open/Create/Exclusive_41, but that will be resolved in a future commit. Note that the Linux, Solaris and FreeBSD clients do not set archive, hidden or system for Open/Create, so the bug does not affect mounts from those clients. PR: 292283 (cherry picked from commit a6d57f312f18bbeeda8a34e99d0a662b0db9a190) sys/fs/nfsserver/nfs_nfsdport.c | 11 +++++++++++ sys/fs/nfsserver/nfs_nfsdsubs.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
The patch has been MFC'd.
(In reply to commit-hook from comment #9) In which FreeBSD 15.x release is this fixed ?