Cross filesystem move behavior
Michael Gerdts
Michael.Gerdts at usa.alcatel.com
Fri May 11 13:15:26 GMT 2001
When a share crosses file systems, "moving" a file from one file system to
another fails from an NT client (ERRnaccess). This appears to be a result
of conn->vfs_ops.rename() failing. Since it eventually just calls
rename(), that is expected. Relevant log entries are:
Is there any reason to *not* make it a bit friendlier to the poor windows
user? I propose doing this by copying the file (or entire file
heirarchy, in the case of a directory move) then removing the file from the
source. mv(1) in Solaris handles it this way, just in case anyone is
looking for a precedent.
More specifically the algorithm within vfswrap_rename() would look like:
result = rename(old, new);
if ( result != 0 ) {
stat(old, oldbuf)
stat(new, newbuf)
if ( oldbuf.st_dev != newbuf.st_dev ) {
result = move(old, new);
}
}
Then move would be:
int move(char *old, char *new) {
if ( old is a directory ) {
create new/dir
for each file in old
move(old/file, new/file)
} else {
copy old to new
unlink(old)
}
}
I am not promising to implement this, but if I am looking for a smallish
coding project I may implement it. That is, assuming that I don't have
people screaming "That idea sucks!"
Mike
More information about the samba-technical
mailing list