Re: FreeBSD 15-20250822 NFSv4.1 server broken?

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Fri, 22 Aug 2025 19:29:35 UTC
On Fri, Aug 22, 2025 at 8:05 AM Cedric Blancher
<cedric.blancher@gmail.com> wrote:
>
> On Fri, 22 Aug 2025 at 16:16, Rick Macklem <rick.macklem@gmail.com> wrote:
> >
> > On Fri, Aug 22, 2025 at 6:48 AM Cedric Blancher
> > <cedric.blancher@gmail.com> wrote:
> > >
> > > On Fri, 22 Aug 2025 at 15:27, Rick Macklem <rick.macklem@gmail.com> wrote:
> > > >
> > > > On Fri, Aug 22, 2025 at 3:38 AM Cedric Blancher
> > > > <cedric.blancher@gmail.com> wrote:
> > > > >
> > > > > Good morning!
> > > > >
> > > > > FreeBSD 15-2025082, NFSv4.1 server set up like this:
> > > > > # sysrc nfs_server_enable=YES
> > > > > # sysrc nfsv4_server_enable=YES
> > > > > # sysrc nfsuserd_enable=YES
> > > > > # sysrc nfscbd_enable=YES
> > > > > # sysctl vfs.nfs.enable_uidtostring=1
> > > > > # sysctl vfs.nfsd.enable_stringtouid=1
> > > > > # sysctl vfs.nfsd.issue_delegations=1
> > > > > # printf 'V4: / -sec=sys\n' >>'/etc/exports'
> > > > > # service nfsd start
> > > > > # cat /etc/exports
> > > > > V4: / -sec=sys
> > > > This line only defines where the NFSv4 root is and
> > > > what security is required for system state operations
> > > > (ones not using any files).
> > > >
> > > > You also need to export the file systems as separate
> > > > lines. If using ZFS, you can do so via the "sharenfs"
> > > > property or by additional line(s) written manually in
> > > > /etc/exports. For other file systems, like UFS, you
> > > > need to put the lines in /etc/exports manually.
> > > >
> > > > One (or more, if different client hosts get different
> > > > flags) for each file system. Each line will look
> > > > something like:
> > > > /home -maproot=root -alldirs -network 192.168.1.0/24
> > > >
> > > > The simplest variant (if your system is just one
> > > > file system) would be a line like:
> > > > /
> > > >
> > > > See the examples section of "man exports".
> > > >
> > > > After updating /etc/exports, you need to...
> > > > # service mountd reload
> > > > to get mountd to update the exports in the kernel
> > > > from what is in /etc/exports.
> > > >
> > > > rick
> > > > ps: Yes, "man exports" is confusing. I plan on trying to
> > > >       improve it someday.
> > >
> > > I tried the following setup after a clean install. It works with
> > > FreeBSD 14.3, but fails with the latest FreeBSD 15 snapshot from
> > > today.
> > > Could you PLEASE have a look whether you get the same failures on
> > > Linux as we did?
> > Well, nothing should change with regard to this between 14.3 and 15.0.
> > As for the snapshots, well, they have a lot of issues right now.
> > (I will be trying a snapshot at some point soon, but I have been waiting
> > for the dust to settle.)
> >
> > > ---- cut-here ----
> > > 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
> > > sysctl vfs.nfs.enable_uidtostring=1
> > > sysctl vfs.nfsd.enable_stringtouid=1
> > > sysctl vfs.nfsd.issue_delegations=1
> > >
> > > mkdir /nfsdata
> > > chmod a+rwxt /nfsdata
> > >
> > > # NFSv4.1 exports must come after the 'V4: /' line,
> > > # otherwise you get a NFS4ERR_NOFILEHANDLE
> > > printf 'V4: /\n' >'/etc/exports'
> > The only suggestion might be to try..
> > V4:/nfsdata
> > and the mount with something like <server>:/.
> >
> > Both should work and, as you noted, did work for 14.3,
> > so it shouldn't matter.
> >
> > I suspect it is just a snapshot problem, rick
>
> I hope so, because we need O_NAMEDATTR. Which was the reason for
> today's multidisciplinary test campaign.
>
> FreeBSD 14.3 works fine as an NFSv4.2 server (thank you all!), but we
> need FreeBSD 15.
Ok. I just tried a snapshot and it worked for me.
Here's what I did.
- downloaded a file with "amd64", "20250822" and "disc1.iso" in the name.
- Ran an install of it in a little VM.
When asked...
- Traditional vs pkg based, I chose Traditional.
- When asked about partitioning, I chose Manual.
  - I created three partitions:
   freebsd-ufs 12Gbytes mounted on /
   freebsd-swap 4Gbytes
   freebsd-zfs 16Gbyte
When the install completed and I rebooted it, I edited  /etc/rc.conf
so it looked like:
hostname="nfsv4-test"
ifconfig_vtnet0="inet 192.168.1.15 netmask 255.255.255.0"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
background_fsck="NO"
defaultrouter="192.168.1.254"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
background_fsck="NO"
nfsuserd_enable="YES"
nfsuserd_flags="-domain nfsv4.dev"
nfs_client_enable="YES"
nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsv4_server_only="YES"
nfs_access_cache="30"
nfs_reserved_port_only="YES"
nfscbd_enable="YES"
nfs_server_flags="-t -n 32"
mountd_enable="YES"
mountd_flags="-r -S"
zfs_enable="YES"

And I edited /etc/exports so it looked like:
/example -sec=sys -alldirs -maproot=root
V4: /example -sec=sys

Then I did the following as root/su:
# service zfs start
# zpool create example /dev/vtbd0s1d
# zfs set xattr=dir example
--> Then I rebooted and it worked ok for a simple test
      from a client using named attributes.
The FreeBSD mount command looked like:
# mount -t nfs -o nfsv4 192.168.1.15:/ /mnt
# cd /mnt
- created a file called "foo" then
# runat foo ls -l
total 0
# runat foo cp /etc/exports myattr1
# runat foo ls -l
total 2
-rw-r--r-- 1 root wheel 63 Aug 22 05:13 myattr1

rick
ps: Obviously, things like /dev/vtbd0 might be different, based
      on where/how you install it.
pss: Note that this was a snapshot of to-day. They are
      "a bit bumpy" right now, as re@ says. (Some might
      say he is a master of understatement;-)



>
> Ced
> --
> Cedric Blancher <cedric.blancher@gmail.com>
> [https://plus.google.com/u/0/+CedricBlancher/]
> Institute Pasteur
>