File duplication on NFSv4 exported ZFS filesystems to centos client

Rick Macklem rmacklem at uoguelph.ca
Fri Dec 2 23:36:28 UTC 2016


Jordan Ladora wrote:
>Curious phenomenon of file pseudo-dup with exported ZFS filesystems on
>FreeBSD 10.3-REL NFSv4 export to a centos7 client.
>
>
>*FreeBSD server-*
>
>zpool create zpool_nfsv4 ...
>
>zfs create zpool_nfsv4/zfs2
>
>zfs create zpool_nfsv4/zfs3
>
>
>/etc/exports-
>
>V4: /
>
>/zpool_nfsv4
>
>/zpool_nfsv4/zfs2
>
>/zpool_nfsv4/zfs3
>
>
>zfs unshare -a
>
>
>*Centos client-*
>
>mkdir /zpool_nfsv4
>
>mkdir /zpool_nfsv4_zfs2
>
>mkdir /zpool_nfsv4_zfs3
>
>mount -t nfs4 -o rw,intr,hard,proto=tcp,nodev,noexec,nosuid
>10.0.100.100:/zpool_nfsv4
>/zpool_nfsv4
>
- I'll call this mount #2.
>mount -t nfs4 -o rw,intr,hard,proto=tcp,nodev,noexec,nosuid
>10.0.100.100:/zpool_nfsv4/zfs2
>/zpool_nfsv4_zfs2
- I'll call this mount #3.
>mount -t nfs4 -o rw,intr,hard,proto=tcp,nodev,noexec,nosuid
>10.0.100.100:/zpool_nfsv4/zfs3
>/zpool_nfsv4_zfs3
By default (unlike NFSv3) NFSv4 mounts the entire tree of file systems
under the mount point and not just the file system being mounted.
You have two choices:
1 - Don't do mount #2 or mount #3. The first mount should allow you to
     access /zpool_nfsv4/zfs2 and /zpool_nfsv4/zfs3 with the addition mounts.
OR
2 - Turn of the "whole tree" behaviour on the server via:
# sysctl vfs.nfsd.mirrormnt=0
on the FreeBSD server.
(I know, mirrormnt is a weird name for it, but that is what Linux used, so...
 I guess it means "mirror the tree of mounted file systems on the server to the clients".)
[stuff snipped]
>This seems similar to this (https://serverfault.com/quest
>ions/535318/creating-two-nfs-shares-from-same-server-but-
>when-mounted-both-point-to-same-d) thread with NFSv4 exports on a centos
>server, but I cannot find anything similar to what I see here with a
>FreeBSD NFSv4 server.
What you did definitely had the same file systems mounted multiple times,
so I suspect that is what caused this behaviour.

rick




More information about the freebsd-net mailing list