2.2.5pre1: unlink design flaw

Mike Gerdts Michael.Gerdts at alcatel.com
Thu Jun 13 05:55:01 GMT 2002


On Wed, 2002-06-12 at 18:10, Simo Sorce wrote:
> And samba is not the only application that do this kind of operation,
> the proper fix would be to make smbfs driver able to "hide" a file if it
> is unlilnked but yet open by some process, and then silently unlink it
> when the last process closes it.
> 
> It just involves a per open file counter and some kind of magic on
> directory listing/file opening.

Under HP-UX 10.20 I ran into issues with automated software updates (via
package from AFS or rsync, I forget) in that files (executables) that
were in use could not be unlinked.  As a result the software would
rename the file with a .OLD extension.  I then would periodically do a
find through the file system to get rid of all .OLD filess.  What a
waste of I/O bandwidth.

The solution that I did not find the time to implement was to create a
.OLD directory on each mounted file system.  All .OLD files could then
be moved by the update tool into <mntpt>/.OLD.  Then the cleanup process
would only have one directory per file system to look at.

A similar solution could be used here.  The equivalent of the .OLD
directory could be something that is not exported by samba.  If an
unlink() fails because of ETXTBUSY, rename() could be used to move it
out of the shared directory to a directory that is monitored by a
"deleted file reaper".

Mike





More information about the samba-technical mailing list