|
|
Log in / Subscribe / Register

vfs: add O_CREAT|O_DIRECTORY to open*(2)

From:  Jori Koolstra <jkoolstra-AT-xs4all.nl>
To:  Christian Brauner <brauner-AT-kernel.org>, linux-fsdevel-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, Jan Kara <jack-AT-suse.cz>, Al Viro <viro-AT-zeniv.linux.org.uk>, NeilBrown <neilb-AT-suse.de>
Subject:  [PATCH v2 00/14] vfs: add O_CREAT|O_DIRECTORY to open*(2)
Date:  Mon, 29 Jun 2026 17:36:16 +0200
Message-ID:  <20260629153630.2158649-1-jkoolstra@xs4all.nl>
Cc:  Aleksa Sarai <cyphar-AT-cyphar.com>, Amir Goldstein <amir73il-AT-gmail.com>, Jeff Layton <jlayton-AT-kernel.org>, Jori Koolstra <jkoolstra-AT-xs4all.nl>
Archive-link:  Article

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 (14):
  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()
  vfs: call audit_inode_child() in lookup_open() on failure too
  fs/namei.c: don't dput() when atomic_open() errors
  vfs: lookup_open(): move setting FMODE_CREATED down
  fs/namei.c: lookup_open(): move i_op->create check 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: fix headers in fclog.c
  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                                    | 291 ++++++++++++------
 fs/nfs/dir.c                                  |   6 +
 fs/open.c                                     |  32 +-
 fs/smb/client/dir.c                           |   3 +
 fs/vboxsf/dir.c                               |   3 +
 include/linux/fcntl.h                         |   6 +
 .../testing/selftests/filesystems/.gitignore  |   1 +
 tools/testing/selftests/filesystems/Makefile  |   2 +-
 tools/testing/selftests/filesystems/fclog.c   |   4 +-
 .../filesystems/open_o_creat_o_dir.c          | 197 ++++++++++++
 15 files changed, 447 insertions(+), 113 deletions(-)
 create mode 100644 tools/testing/selftests/filesystems/open_o_creat_o_dir.c


base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
-- 
2.54.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds