rename(2) using NTFS transactions on Vista/2008

Corinna Vinschen corinna-cygwin@cygwin.com
Thu May 15 18:03:00 GMT 2008


Hi,

I just applied a patch (rather, three patches) which uses the new
transactional NTFS (TxF) feature introduced with Vista/2008 to add
atomicity in a few border cases of the rename(2) function.  POSIX
requires that rename(2) works atomically, but without the new
transactions, not all cases can be implemented atomically under Windows.
The three border cases are

- The destination file is an existing directory.
- The destination file has the R/O DOS attribute set.
- The destination file exists and does not grant the user DELETE access.
  This is an interesting case which I discussed on a Microsoft newsgroup
  when I asked about the transaction stuff.  For the curious see
  http://tinyurl.com/3uh45d, especially the second reply from Jeffrey
  Tan :)

Obviously I can't implement these cases atomically on older OSes and
maybe even more obviously atomicity only works on TxF filesystems, but
fortunately that's standard with Vista/2008 and you probably wouldn't
have expected otherwise anyway...

I've uploaded cygwin-1.7.0-10 with this change to the release-2 area.

Here's a request:  If you see any other case in Cygwin which should work
atomically, but doesn't right know, please send a mail here.  Maybe
these cases can easily run atomically under Vista/2008/TxF, now that I
have the ground work and know how to do it.


Have fun,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list