[PATCH v5 0/2] vfs: add O_EMPTYPATH to openat(2)/openat2(2)

Jori Koolstra posted 2 patches 1 month, 3 weeks ago
fs/fcntl.c                                    |  2 +-
fs/open.c                                     |  6 +-
include/linux/fcntl.h                         |  2 +-
include/uapi/asm-generic/fcntl.h              |  4 ++
tools/include/uapi/linux/openat2.h            | 43 +++++++++++++++
.../selftests/filesystems/openat2/Makefile    |  4 +-
.../filesystems/openat2/emptypath_test.c      | 55 +++++++++++++++++++
.../selftests/filesystems/openat2/helpers.h   | 35 +-----------
8 files changed, 111 insertions(+), 40 deletions(-)
create mode 100644 tools/include/uapi/linux/openat2.h
create mode 100644 tools/testing/selftests/filesystems/openat2/emptypath_test.c
[PATCH v5 0/2] vfs: add O_EMPTYPATH to openat(2)/openat2(2)
Posted by Jori Koolstra 1 month, 3 weeks ago
Hi Christian,

I've rebased this on vfs-7.2.misc as Aleksa suggested. Also moved the
O_EMPTYPATH bit to 1<<26 to avoid conflict with non asm-generic O_*
flags.

---

To get an operable version of an O_PATH file descriptor, it is possible
to use openat(fd, ".", O_DIRECTORY) for directories, but other files
currently require going through open("/proc/<pid>/fd/<nr>"), which
depends on a functioning procfs.

This patch adds the O_EMPTYPATH flag to openat(2)/openat2(2). If passed,
LOOKUP_EMPTY is set at path resolution time.

Jori Koolstra (2):
  vfs: add O_EMPTYPATH to openat(2)/openat2(2)
  selftest: add tests for O_EMPTYPATH

 fs/fcntl.c                                    |  2 +-
 fs/open.c                                     |  6 +-
 include/linux/fcntl.h                         |  2 +-
 include/uapi/asm-generic/fcntl.h              |  4 ++
 tools/include/uapi/linux/openat2.h            | 43 +++++++++++++++
 .../selftests/filesystems/openat2/Makefile    |  4 +-
 .../filesystems/openat2/emptypath_test.c      | 55 +++++++++++++++++++
 .../selftests/filesystems/openat2/helpers.h   | 35 +-----------
 8 files changed, 111 insertions(+), 40 deletions(-)
 create mode 100644 tools/include/uapi/linux/openat2.h
 create mode 100644 tools/testing/selftests/filesystems/openat2/emptypath_test.c

-- 
2.54.0
Re: [PATCH v5 0/2] vfs: add O_EMPTYPATH to openat(2)/openat2(2)
Posted by Christian Brauner 1 month, 1 week ago
On Fri, 24 Apr 2026 13:46:01 +0200, Jori Koolstra wrote:
> I've rebased this on vfs-7.2.misc as Aleksa suggested. Also moved the
> O_EMPTYPATH bit to 1<<26 to avoid conflict with non asm-generic O_*
> flags.

Applied to the vfs-7.2.misc branch of the vfs/vfs.git tree.
Patches in the vfs-7.2.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.2.misc

[1/2] vfs: add O_EMPTYPATH to openat(2)/openat2(2)
      https://git.kernel.org/vfs/vfs/c/6703991ad3a3
[2/2] selftest: add tests for O_EMPTYPATH
      https://git.kernel.org/vfs/vfs/c/00f84ea205cd