NFS bug with child datasets

Status
Not open for further replies.

gizimoto

Cadet
Joined
Nov 30, 2012
Messages
9
After seeing some odd behaviour with my NFS shares (http://forums.freenas.org/showthread.php?10655) I believe I have found a bug.

Child datasets under NFS sharing do not correctly write data to the ZFS dataset, rather to a normal directory.

Here is how to repeat the issue:

Create ZFS data set with child dataset, for example
/mnt/storage/test
/mnt/storage/test/testchild

Create an NFS share on the higher level /mnt/storage/test location.

Mount the NFS share, I use Ubuntu and AutoFS, but 'mount -t nfs 192.168.1.205:/mnt/storage/test /mnt/test' shows same behaviour.

Any files/folders created in the test/testchild folder do not appear when viewing the files directly from the FreeNAS shell (nor from a CIFS share which is how I found the issue).

For example from my Ubuntu server:

Code:
mark@ubuntuserver:/mnt/test$ mount -l
... snip ...
192.168.1.205:/mnt/storage/test on /mnt/test type nfs (rw,addr=192.168.1.205)
mark@ubuntuserver:/mnt/test$ ls -la
total 38
drwxrwxr-x 3 root 1001 3 Jan  6 11:08 .
drwxr-xr-x 5 root root 0 Jan  6 11:03 ..
drwxr-xr-x 2 root 1001 3 Jan  6 11:09 testchild
mark@ubuntuserver:/mnt/test$ cd testchild/
mark@ubuntuserver:/mnt/test/testchild$ vi from_ubuntuserver_nfs.txt
mark@ubuntuserver:/mnt/test/testchild$ ls -la
total 48
drwxr-xr-x 2 root 1001 3 Jan  6 11:09 .
drwxrwxr-x 3 root 1001 3 Jan  6 11:08 ..
-rw-rw-r-- 1 root 1001 6 Jan  6 11:09 from_ubuntuserver_nfs.txt


Then from the FreeNAS shell the TXT file does not appear:

Code:
[root@freenas] /mnt/storage/test> ls -la
total 57
drwxrwxr-x  3 root  media  3 Jan  6 11:08 ./
drwxr-xr-x  9 root  wheel  9 Jan  6 10:59 ../
drwxrwxr-x  2 root  media  2 Jan  6 11:00 testchild/
[root@freenas] /mnt/storage/test> cd testchild/
[root@freenas] /mnt/storage/test/testchild> ls -la
total 38
drwxrwxr-x  2 root  media  2 Jan  6 11:00 ./
drwxrwxr-x  3 root  media  3 Jan  6 11:08 ../


I also copied a 'large' file into the 'testchild' folder via NFS to see if the volume used GUI updated - it did not.

Now if I delete the 'testchild' data set, and repeat the check from the FreeNAS shell, i get:


Code:
[root@freenas] /mnt/storage/test> ls -la
total 57
drwxrwxr-x  3 root  media  3 Jan  6 11:08 ./
drwxr-xr-x  9 root  wheel  9 Jan  6 10:59 ../
drwxr-xr-x  2 root  media  3 Jan  6 11:09 testchild/
[root@freenas] /mnt/storage/test> cd testchild
[root@freenas] /mnt/storage/test/testchild> ls -la
total 48
drwxr-xr-x  2 root  media  3 Jan  6 11:09 ./
drwxrwxr-x  3 root  media  3 Jan  6 11:08 ../
-rw-rw-r--  1 root  media  6 Jan  6 11:09 from_ubuntuserver_nfs.txt


So I think that NFS is treating 'testchild' as a folder, rather than a dataset and ZFS via shell/CIFS hides this folder and uses the dataset instead.

Which with my limited knowledge means that snapshots on these child datasets will snap empty folders.

Anybody able to comment/correct my findings? I am running FreeNAS-8.3.0-RELEASE-p1-x64 (r12825) under ESXi VM.

Mark
 

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
That is not a bug.

NFS shares does not span filesystem. A dataset is considered a new filesystem in the OS level, not a folder.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I think he just discovered under-mountpoint content hiding, an ancient UNIX technique. :smile:
 

gizimoto

Cadet
Joined
Nov 30, 2012
Messages
9
Indeed I did re-discover this technique - I've reworked my setup to ensure NFS only ever mounts the lowest sibling ZFS dataset and ditched NFS for CIFS where suitable.

Do you think this could be outlined a little better in the manual, I see there is a one liner mentioning this, but as a noob to FreeNAS and NFS it did not hit home fully.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Where's the one-liner and ... well, here's kind of the problem for me. Having used UNIX for decades, this sort of "problem" doesn't even necessarily strike me so much as a problem as it does an obscure feature and potential newbie trap. So what I'm wondering is if you have a specific suggestion as to how to make it exceedingly clear. If you point me to the one-liner and provide a better short summary of the problem, I think I may have manual editing privileges and I'd be happy to change it, then maybe expand upon it if that seems prudent.
 

Neek

Dabbler
Joined
Feb 10, 2014
Messages
43
Though it's an old thread, I stumbled upon this issue tonight so I thought I'd add my $0.02:

While a ZFS dataset is, to the OS, basically a different file system, it doesn't need to be so from the perspective of NFS. What benefit does a user see in having sub-datasets not mount as subdirectories? What risks would this bring to the OS or the data?

It seems like this is one of those places where a modern filesystem layered atop a very old sharing protocol should yield a better behavior than what it actually does today.
 
Status
Not open for further replies.
Top