3 ms·
> Today, you still have to jump through hoops to do atomic file replace, and the hoops are different for different OSs Do you? I may be misunderstanding you, b
by jstimpfle 10y ago
> Today, you still have to jump through hoops to do atomic file replace, and the hoops are different for different OSs
Do you? I may be misunderstanding you, but Posix says rename() is atomic.
Regarding your file system issues, note that you can have most of this with O_TMPFILE on linux. I think the slight exception is that file modes can't be restored if you are not a member of the original file's user or group.
But disregarding that, the file system changes you suggest (strict separation of "unit", "log", "managed", "temp" files) are artificial, so I don't think that they belong in the kernel. It's the old mechanism vs policy theme.
A small issue I have with Posix file systems is that the transaction granularity is a single file or sub-tree. You can't have transactions that affect file in distinct sub-trees.
- Animats 10y agoIt's complicated. Posix "rename()" is now supposed to be atomic, but it isn't on NFS.[1] Windows has version problems. XP couldn't do an atomic rename. Vista could for NTFS file systems, using the NTFS transactional rename function. That's now deprecated in favor of ReplaceFile, which came in with Windows 7.[2] That's supposed to be atomic even if a copy across file systems is required. Not sure about Windows file shares. In MacOS X, "rename" was not atomic before 2011. It's now believed to be.[3] Even with "rename", you have to find the directory in which the old file lives, and create the new file there (as something like a ".part" file) before renaming. This requires resolving symbolic links and such. So it's non-trivial to get this right. My point is that this should Just Work as the default. [1] http://stackoverflow.com/questions/41362016/rename-atomicity-and-nfs http://stackoverflow.com/questions/41362016/rename-atomicity... [2] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365512(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/aa3... [3] http://www.weirdnet.nl/apple/rename.html http://www.weirdnet.nl/apple/rename.html