Bug 6800 - patch for SMB rename across disk partitions
Summary: patch for SMB rename across disk partitions
Status: NEW
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All Linux
: P3 normal
Target Milestone: ---
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL: http://www.acquerra.com.au/samba-rena...
Depends on:
Reported: 2009-10-11 06:18 UTC by Anthony Wesley
Modified: 2011-06-14 11:54 UTC (History)
1 user (show)

See Also:

copy for the bugzilla db of the mentioned patch (5.33 KB, patch)
2011-06-14 11:54 UTC, Björn Jacke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Wesley 2009-10-11 06:18:21 UTC
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.

regards, Anthony
Comment 1 Björn Jacke 2011-06-14 11:54:21 UTC
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.