Re: zfs sharenfs woes

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Wed, 23 Jul 2025 15:56:41 UTC
On Wed, Jul 23, 2025 at 8:38 AM void <void@f-m.fm> wrote:
>
> On Wed, Jul 23, 2025 at 07:58:31AM -0700, Rick Macklem wrote:
>
> >des@ figured it out. I didn't realize /etc/zfs/exports is only read
> >if zfs_enable="YES".
>
> so, that line has to be there, uncommented, even if kldload zfs
> and then zpool import -a and *then* zfs share -a ?
>
> Does it look like a bug, especially after zfs share -a ?
Well, it is definitely a glitch in the way that the ZFS sharenfs
property is implemented for FreeBSD.

If you look at /etc/rc.d/mountd, you'll see it only includes
/etc/zfs/exports when zfs_enable="YES". The assumption
appears to be "if someone wants ZFS file systems exported,
they will have zfs_enable set to yes".

It could be changed to remove that condition, but that could
result in a POLA violation, where someone set zfs_enable="NO"
to disable ZFS and ZFS exporting (ie. the /etc/zfs/exports file
exists, but the user wanted it disabled).

The workaround would be to add a line like:
mountd_flags="-r -S /etc/zfs/exports"
to your /etc/rc.conf instead of setting zfs_enable="YES".

rick

> --
>