Samba and ZFS: Snapshot folder appears empty via SMB share but can 'cd' into subfolders

Andrea Mencarelli andrea3000 at gmail.com
Sat Sep 17 05:49:58 UTC 2022



Hello,

I'm running the latest version of OpenZFS on Linux (Unraid) with Samba 4.15.7.

I have encountered a very annoying issue that I can't seem to be able to resolve.
I run hourly snapshots on all my datasets in the ZFS pool, and I can see and access them just fine on the server by browsing to the hidden .zfs/snapshot directory, which contains a directory for each snapshot created for that dataset.
I have also set snapdir visibility to visible in ZFS. 

To be able to access the data on the ZFS pool from the client (MacOS) I use a Samba share that is configured like this:
[global]
vfs objects = catia fruit streams_xattr
fruit:aapl = yes
fruit:model = MacSamba
fruit:metadata = stream
fruit:resource = xattr
fruit:encoding = native
fruit:nfs_aces = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes
ea support = yes
map archive = no
map hidden = no
map system = no
store dos attributes = no

[ShareTest]
path = /zfs/test
comment = ShareTest
browseable = yes
writeable = yes
valid users = andrea
write list = andrea
guest ok = no
create mask = 0775
directory mask = 0775
vfs objects = catia fruit streams_xattr
veto files = /.DS_Store/
delete veto files = yes

When I connect to the Samba share from the MacOS client (but the same happens from Windows) like this:
smb://[IP address of server]/ShareTest

I can cd to the hidden /ShareTest/.zfs directory. 
Inside there I can list and cd into the snapshot directory.
However, if I do ls -a inside the snapshot directory I don't see any of the snapshots folders. 
andrea at 192 snapshot % pwd
/Volumes/ShareTest/.zfs/snapshot
andrea at 192 snapshot % ls -a
.	.. 

However, if I try to cd into any of the snapshot folders by starting to type the name of the directory and pressing tab to autocomplete, the auto-completion shows all the missing folders and I can cd into any of them.
andrea at 192 snapshot % cd 2022-0
2022-08-21_18-00/  2022-08-24_08-00/  2022-08-25_20-00/  2022-08-28_15-00/  2022-09-03_22-00/  2022-09-09_23-00/  2022-09-11_10-00/
2022-08-23_22-00/  2022-08-24_23-00/  2022-08-25_21-00/  2022-09-03_12-00/  2022-09-03_23-00/  2022-09-10_17-00/ 

As far as I know, when something like this happens is because I don't have read permission on the snapshots directories. This isn't the case this time, though.

What's even more odd is that if I do the following:
- Try to (unsuccessfully) list the snapshots folders for a given share
- Restart the Samba service with this command: smbcontrol all reload-config
- Try again to reconnect to the share and list the snapshot folders

It almost always shows all the snapshots this time!!
This only applies to that given share (and not the others) and only until I reboot the server or the client.
For example, if I connect to a different share and I try to list the snapshots, I get an empty list again and I have to restart the Samba service once more.

Does anybody know what's causing this issue?
 


More information about the samba-technical mailing list