[PATCH V2 RESEND] win32: improve the performance of win32.unlink() over CIFS

Kaz Nishimura kazssym at vx68k.org
Thu Feb 20 11:13:59 CST 2014

To make a file completely deleted, we must have the last open file handle.
If we open the file non-exclusively, we cannot assure that and must always
use slower rename and unlink.  If there is a way to make sure we have the
last open handle, we can avoid exclusive open totally.  Can you suggest any?

Win32 API is unclear about hard links and the effect of the DELETE_ON_CLOSE
flag.  If the flag is set and all open handles are closed, the file must be
deleted according to the description, but if a handle is opened from
another hard link, nothing is described about what happens.  I could be
confused.  Apparently the flag must be set on the hard link not on the file

We could add FLAG_SHARE_DELETE to make deletion of other hard links
possible, but if any file handles with DELETE access might remain too long
(I think unlikely), the file name (or hard link) can remain longer than we
want.  Any solution here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140221/f5cd83e6/attachment.html>

More information about the Mercurial-devel mailing list