O_DIRECTORY|O_TMPFILE
O_DIRECTORY|O_TMPFILE
Posted Aug 2, 2026 3:01 UTC (Sun) by koverstreet (subscriber, #4296)In reply to: O_DIRECTORY|O_TMPFILE by donald.buczek
Parent article: Reconsidering O_CREAT|O_DIRECTORY
It'd create others, though: unlinked files are a problem for observability; if you forget to kill something, or a program is doing something unexpected, it makes "where'd my disk space go" into a real game.
Private mount namespaces can create similar problems.
So, as the bcachefs maintainer: I'd be happy to take patches or implement O_DIRECTORY|O_TMPFILE in bcachefs - after we have a solution to that one.
It'd need major cooperation between the VFS and the filesystem. The filesystem would have to implement rm -rf in .evict(), and that means on disk format changes because unlinked files have to be processed in recovery, and an unlinked file is not quite the same thing as an unlinked directory.
You'd need the VFS to track when the tree has gone away, and the dcache would have to be able to operate on disconnected subtrees. The VFS does this sort of tracking today only in the context of a mount, not a random disconnected directory, to my knowledge.
