News › linux

Linux Proposes O_CREAT|O_DIRECTORY Flag for Race-Free Directory Creation

By Zayden R., July 31, 2026

Jori Koolstra is working on a new Linux system call feature to create and open directories in a single race-free operation, repurposing a set of open() flags. This aims to improve efficiency and safety in file operations.

Linux developers are exploring a significant enhancement to the file system interface: the ability to create and open directories in a single, race-free operation. Jori Koolstra has proposed repurposing a set of open() flags, specifically O_CREAT|O_DIRECTORY, which currently return an error, to achieve this functionality. This proposed change could streamline file system operations and reduce the risk of race conditions.

Currently, Linux provides mkdir() to create directories and open() to open them, but lacks a system call that combines these actions safely. This gap can lead to race conditions where a directory might be altered between creation and opening, potentially causing data inconsistency or security issues. Koolstra's proposal to utilize currently unused flags in open() could provide a much-needed solution.

Despite its potential benefits, the proposal is not without controversy. Designing user-space interfaces that avoid pitfalls is notoriously challenging, and this is no exception. Developers are concerned about the possible introduction of new user-space traps, as well as backward compatibility with existing applications that might not expect these flags to function differently.

If implemented, this change would mark a noteworthy improvement in how Linux handles directory operations. Engineers working with file systems could expect more efficient and reliable directory creation processes, reducing the need for complex workarounds. However, the community will need to carefully evaluate the proposal to ensure it aligns with Linux's commitment to stability and backward compatibility.

Sources

Practice this on a real machine

The Linux Camp teaches these topics as hands-on labs on real virtual machines, verified as you type.