The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v3 00/14] vfs: add O_CREAT|O_DIRECTORY to open*(2)
@ 2026-07-04 16:41 Jori Koolstra
  2026-07-04 16:41 ` [PATCH v3 01/14] fs/namei.c: use trailing_slashes() Jori Koolstra
                   ` (13 more replies)
  0 siblings, 14 replies; 30+ messages in thread
From: Jori Koolstra @ 2026-07-04 16:41 UTC (permalink / raw)
  To: Jeff Layton, Christian Brauner, Al Viro, Aleksa Sarai, NeilBrown,
	Amir Goldstein, Jan Kara
  Cc: linux-fsdevel, linux-kernel, Jori Koolstra

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).

Most of the work happens in "vfs: add O_CREAT|O_DIRECTORY to open*(2),"
as may be expected. Before that there is some clean-up work and
preparation. Also, the inconsistency in calling audit_inode_child() in
lookup_open() versus vfs_create() path is addressed. The
"vfs: short-circuit MAY_WRITE access for O_DIRECTORY opens" patch is
also worth paying extra attention to as it short-circuits doomed opening
of directories as writable. This check for regular files is now done
very late in do_open(), but for O_CREAT|O_DIRECTORY this is unacceptable
as this would create the directory and then still fail.

Jori Koolstra (14):
  fs/namei.c: use trailing_slashes()
  vfs: 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: update docstring of atomic_open()
  vfs: lookup_open(): move setting FMODE_CREATED down
  vfs: move ->create check in lookup_open() 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 from lookup_open() into 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                                    | 313 ++++++++++++------
 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, 463 insertions(+), 119 deletions(-)
 create mode 100644 tools/testing/selftests/filesystems/open_o_creat_o_dir.c

-- 
2.55.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2026-07-06 23:02 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-04 16:41 [PATCH v3 00/14] vfs: add O_CREAT|O_DIRECTORY to open*(2) Jori Koolstra
2026-07-04 16:41 ` [PATCH v3 01/14] fs/namei.c: use trailing_slashes() Jori Koolstra
2026-07-06  3:56   ` NeilBrown
2026-07-06  7:29     ` David Laight
2026-07-06 20:55       ` Jori Koolstra
2026-07-04 16:41 ` [PATCH v3 02/14] vfs: move create error && negative dentry case in lookup_open() up Jori Koolstra
2026-07-04 16:41 ` [PATCH v3 03/14] vfs: prepare vfs_creat|mkdir_no_perm for reuse in lookup_open() Jori Koolstra
2026-07-04 16:41 ` [PATCH v3 04/14] vfs: call audit_inode_child() in lookup_open() on failure too Jori Koolstra
2026-07-06  5:33   ` NeilBrown
2026-07-06 21:20     ` Jori Koolstra
2026-07-06 23:02       ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 05/14] fs/namei.c: update docstring of atomic_open() Jori Koolstra
2026-07-06  5:36   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 06/14] vfs: lookup_open(): move setting FMODE_CREATED down Jori Koolstra
2026-07-04 16:41 ` [PATCH v3 07/14] vfs: move ->create check in lookup_open() to before try_break_deleg() Jori Koolstra
2026-07-06  5:37   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 08/14] vfs: lookup_open(): use vfs_create_no_perm() Jori Koolstra
2026-07-06  5:38   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 09/14] vfs: add O_CREAT|O_DIRECTORY to open*(2) Jori Koolstra
2026-07-06  5:46   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 10/14] vfs: move O_IS_MKDIR check from lookup_open() into individual filesystems Jori Koolstra
2026-07-06  5:50   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 11/14] vfs: refuse O_CREAT for directories through a dangling symlink Jori Koolstra
2026-07-06  5:51   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 12/14] vfs: short-circuit MAY_WRITE access for O_DIRECTORY opens Jori Koolstra
2026-07-06  5:51   ` NeilBrown
2026-07-04 16:41 ` [PATCH v3 13/14] selftest: fix headers in fclog.c Jori Koolstra
2026-07-06  5:57   ` NeilBrown
2026-07-06 21:07     ` Jori Koolstra
2026-07-04 16:41 ` [PATCH v3 14/14] selftest: add tests for open*(O_CREAT|O_DIRECTORY) Jori Koolstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox