Find at the URL above a patch to the code in source/modules/vfs_default.c for better support of renaming a file across a disk partition on the host.
The pre-existing code (copy_reg) which implemented the rename via copy/unlink was not very good, and this patch fixes a number of issues. The pre-existing code is present in all versions of samba (3.0, 3.2, 3.4 and perhaps 4.0).
Specifically this patch makes the following changes:
- Files are copied to a temporary name in the destination directory and then renamed upon success. The temp name is chosen to have a "." as prefix and a semi-random suffix.
- The temp file is created with perms set to "---------" and only changed if
the copy succeeds.
- If the copy/rename fails then the destination temp file is removed.
TODO: Perhaps posix ACL's should also be copied? I have no experience with them
so I didn't attempt to code that.
NOTE: Although I have tried to use the "samba" internal routines where appropriate, it's possible that I haven't done this correctly or completely, so a code review is required of these changes.
Created attachment 6581 [details]
copy for the bugzilla db of the mentioned patch
thanks. This would be an enhancement for the vfs crossrename module now. And yes, copyinf the ACL information is still not being done by the samba serversite cross filesystem rename code.