I am working on a safe and race-condition-free alternative to
umount -l with removable devices:
I'm planning on:
umount --moveunder a
000permissions directory so no more files can be opened by absolute path
- Interactively kill (or gracefully shutdown) processes with files open for writing
- Atomically remount read-only only if step (2) is complete
- Interactively kill / close read-only processes that may cause cause issues
- Finally have
There is a race condition in step (3) where a file with relative path could be opened
rw after the last interactive kill and before the
mount -o remount,ro.
mount -o remount,ro guaranteed to fail if there is any file on the filesystem opened for writing?
The manual page is silent on this, and I'm a bit paranoid after finding out that devices are writable even after