Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for December 5, 2013
Deadline scheduling: coming soon?
LWN.net Weekly Edition for November 27, 2013
ACPI for ARM?
LWN.net Weekly Edition for November 21, 2013
Ts'o: Delayed allocation and the zero-length file problem
Posted Mar 13, 2009 20:25 UTC (Fri) by alexl (subscriber, #19068)
fd2=openat(fd1, NULL, O_CREAT) // Creates an unlinked file
flinkat(fd1, fd2, basename(file)) // Should guarantee fd2 is written to disk before linking.
This seems race free:
doesn't break if the directory is moved during write
doesn't let other apps see or modify the temp file while writing
doesn't leave a broken tempfile around on app crash
doesn't end up with an empty file on system crash
Posted Mar 14, 2009 1:41 UTC (Sat) by dcoutts (guest, #5387)
Posted Mar 15, 2009 23:25 UTC (Sun) by halfline (guest, #31920)
Posted Mar 21, 2009 0:34 UTC (Sat) by spitzak (guest, #4593)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds