[PATCH 00/12] vfs: add O_CREAT|O_DIRECTORY to open*(2)
From: Jori Koolstra
Date: Sun Jun 14 2026 - 12:45:07 EST
This series implements new semantics for the O_CREAT|O_DIRECTORY flag
combination for open*(2): perform a mkdir and open the resulting
directory; return a pinning fd (which mkdir does not).
Jori Koolstra (12):
fs/namei.c: use trailing_slashes()
fs/namei.c: move create error && negative dentry case in lookup_open
up
vfs: prepare vfs_creat|mkdir_no_perm for reuse in lookup_open()
fs/namei.c: lookup_open(): move audit_inode_child() up
vfs: lookup_open(): move setting FMODE_CREATED up when calling
create()
vfs: lookup_open(): move i_op->create check to before
try_break_deleg()
vfs: lookup_open(): use vfs_create_no_perm()
vfs: add O_CREAT|O_DIRECTORY to open*(2)
vfs: move O_IS_MKDIR check out atomic_open() to individual filesystems
vfs: refuse O_CREAT for directories through a dangling symlink
vfs: short-circuit MAY_WRITE access for O_DIRECTORY opens
selftest: add tests for open*(O_CREAT|O_DIRECTORY)
fs/9p/vfs_inode.c | 3 +
fs/9p/vfs_inode_dotl.c | 3 +
fs/ceph/file.c | 3 +
fs/fuse/dir.c | 3 +
fs/gfs2/inode.c | 3 +
fs/namei.c | 233 ++++++++++++------
fs/nfs/dir.c | 3 +
fs/nfs/file.c | 3 +
fs/open.c | 32 ++-
fs/smb/client/dir.c | 3 +
fs/vboxsf/dir.c | 3 +
include/linux/fcntl.h | 7 +
.../testing/selftests/filesystems/.gitignore | 1 +
tools/testing/selftests/filesystems/Makefile | 4 +-
tools/testing/selftests/filesystems/fclog.c | 1 +
.../filesystems/open_o_creat_o_dir.c | 197 +++++++++++++++
16 files changed, 413 insertions(+), 89 deletions(-)
create mode 100644 tools/testing/selftests/filesystems/open_o_creat_o_dir.c
base-commit: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6
--
2.54.0