[zfs-discuss] Complex sharenfs setup?

J David j.david.lists at gmail.com
Mon Jan 11 20:26:16 EST 2016


With “zfs sharenfs” how does one specify exports to two different host
specifiers with different, conflciting flags.

I.e. what is the ZFS equivalent of these /etc/exports entries:

/data/export1 192.168.1.40(rw,no_subtree_check,no_root_squash)
/data/export1 192.168.1.0/24(rw,no_subtree_check,anonuid=65534,anongid=65534)

Background:

On our ZFS NFS servers, we are currently using /etc/exports similar to
the above to enumerate the NFS mount points.  This appears to have a
couple of negative effects.

First, it occasionaly causes clients to get “Stale NFS file handle”
errors on a mount points at random after a reboot.  This may be due to
a race condition as to whether ZFS or NFS starts first, as it seems
like the underlying (non-ZFS) empty mount point directory is getting
exported and the ZFS filesystem gets mounted over that, rendering it
inaccessible, leading to the ESTALE errors.  Usually restarting NFS
after the machine is booted will resolve this, though sometimes it
requires all the clients to reboot as well.  Moving to “zfs sharenfs”
may help with this by making sure the right filesystem is mounted
before exporting.

Second, snapshot don’t appear to work over NFS when the ZFS filesystem
is exported via  /etc/exports.  (In fact, sometimes accessing a ZFS
snapshot over NFS causes uninterruptible hang on both client and
server that, on the server side, blocks all access to any snapshot on
the affected filesystem.)  Word on the street is that they do if “zfs
sharenfs” is used instead.  We mostly can work around this, but it’d
be swell not to have to.

So we’d like to switch.  But it’s not clear if we can, since the man
page says ZFS passes the sharenfs more or less straight through to
exportfs.  If this is possible, what would the sharenfs line look
like?  If not, is there any workaround?  (Short of giving superuser
access to a bunch of clients that don’t need it.)

Thanks for any advice!


More information about the zfs-discuss mailing list