pidfs: add pidfs_dentry_open() helper
authorChristian Brauner <brauner@kernel.org>
Wed, 22 Jul 2026 11:56:28 +0000 (13:56 +0200)
committerChristian Brauner <brauner@kernel.org>
Wed, 22 Jul 2026 12:05:15 +0000 (14:05 +0200)
commit927b89700e9fdba61902f8828dbf9b5f29f40ea7
tree9cf5cf7cf59dc2469fbd8c1c98a322e730fb3fe6
parent172ed6c2b676447a1ae39a001d24c955084c458a
pidfs: add pidfs_dentry_open() helper

Both pidfs_alloc_file() and pidfs_export_open() need to force O_RDWR
and reapply the pidfd flags that do_dentry_open() strips. Move the
common logic into a helper.

PIDFD_AUTOKILL is now part of the restore mask in the file handle path
as well, but pidfs_export_permission() rejects O_TRUNC, so this is a
no-op there. But warn nonetheless.

Link: https://patch.msgid.link/20260722-esszimmer-umsetzen-nennt-ed5fc604300a@brauner
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/pidfs.c