Problem solved by using UNIX permissions on the freenas dataset.
Actually, this issue is duplicate of Large repo synced but only tmp files received. The root cause has been discussed in the freenas forum https://forums.freenas.org/index.php?threads/cant-chmod-files-operation-not-permitted.22229/. For further reading search https://www.google.com/search?q=freenas+syncthing+permission+chmod.
TL;DR: freenas does not support chmod with Windows permissions. Windows ACLs are stored in extended attributes so chmod is disabled as a safety to assure consistency in permissions. Syncthing fails the download if a final chmod
fails.
For syncthing trying setfacl
when chmod
fails would elegantly get rid of this issue. Should I open an enhancement request for this?