The button “Optimize all shares for MacOS” on SMB page of File Sharing UI pre-configures advanced settings, including overwriting the following parameter
fruit:zero_file_id = yes
This does not work properly with a number of filesystems; notably – zfs, resulting in samba reporting zero for every file ID, thoroughly confusing Finder on macOS.
For safety, the default shall be OFF:
fruit:zero_file_id = no
For more information please refer to: