3 ms·
I always thought Unix v7+ should have added some kind way to do atomic groups of syscalls, eg: begin_transaction (); lstat ("/path", ...); lstat ("/path/
by rwmj 4y ago
I always thought Unix v7+ should have added some kind way to do atomic groups of syscalls, eg:
begin_transaction ();
lstat ("/path", ...);
lstat ("/path/foo", ...);
commit ();
In Unix v7 mkdir was not a system call. It was a setuid program implemented using mknod + link. That was racy so the mkdir(2) system call was added. But it could have been solved more generally (and more elegantly) by adding transactions.
It could also solve the whole thing with ending up with zero-length files because you didn't use the right incantation to update a file atomically on ext4 (https://thunk.org/tytso/blog/2009/03/12/delayed-allocation-and-the-zero-length-file-problem/ https://thunk.org/tytso/blog/2009/03/12/delayed-allocation-a...).
- bhawks 4y agoA general purpose transactional interface widene the error space to include cross process deadlocks / denial of service not to mention performance issues.
- amaranth 4y agoWasn't making userspace handle these kinds of things a big part of "worse is better"?
- masklinn 4y agoTurns out when facing adversarial actors worse is just worse.