pile 6: f_path stuff
Al Viro
maintainerThe last of the stuff in -next - file->f_path constification.
Only one thing was modifying ->f_path of an opened file - acct(2). Massaging that away and constifying a bunch of struct path * arguments in functions that might be given &file->f_path ends up with the situation where we can turn ->f_path into an anon union of const struct path f_path and struct path __f_path, the latter modified only in a few places in fs/{file_table,open,namei}.c, all for struct file instances that are yet to be opened.
Several conflicts:
[fs/namei.c, include/linux/namei.h]: s/done_path_create/end_creating_path/
in mainline.
[include/linux/namei.h]: end_removing_path() is a wrapper around the same thing,
also needs struct path * argument constified.
[fs/open.c]: trivial conflict in finish_no_open()
[fs/nsfs.c]: less obvious: fs/nsfs.c:nsfs_export_open() needs struct path *
argument constified.
See proposed resolution in #proposed.merge-2...
The following changes since commit a79765248649de77771c24f7be08ff4c96f16f7a:
constify {__,}mnt_is_readonly() (2025-09-17 15:58:29 -0400)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git pull-f_path
for you to fetch changes up to 2f7d98f10b8f64525b2c74cae7d70ae5278eb654:
Have cc(1) catch attempts to modify ->f_path (2025-09-27 20:18:41 -0400)
----------------------------------------------------------------file->f_path constification
----------------------------------------------------------------
Al Viro (24):
backing_file_user_path(): constify struct path *
constify path argument of vfs_statx_path()
filename_lookup(): constify root argument
done_path_create(): constify path argument
bpf...d_path(): constify path argument
nfs: constify path argument of __vfs_getattr() rqst_exp_get_by_name(): constify path argument export_operations->open(): constify path argument
check_export(): constify path argument ksmbd_vfs_path_lookup_locked(): root_share_path can be const struct path * ksmbd_vfs_kern_path_unlock(): constify path argument ksmbd_vfs_inherit_posix_acl(): constify path argument ksmbd_vfs_set_init_posix_acl(): constify path argument ovl_ensure_verity_loaded(): constify datapath argument ovl_validate_verity(): constify {meta,data}path arguments ovl_get_verity_digest(): constify path argument
ovl_lower_dir(): constify path argument
ovl_sync_file(): constify path argument
ovl_is_real_file: constify realpath argument
apparmor/af_unix: constify struct path * arguments configfs:get_target() - release path as soon as we grab configfs_item reference kernel/acct.c: saner struct file treatment
Merge branches 'work.path' and 'work.mount' into work.f_path
Have cc(1) catch attempts to modify ->f_path
fs/bpf_fs_kfuncs.c | 2 +- fs/configfs/symlink.c | 33 ++++----- fs/file_table.c | 6 +- fs/internal.h | 2 +- fs/namei.c | 12 ++-- fs/nfs/localio.c | 2 +- fs/nfsd/export.c | 4 +- fs/nfsd/export.h | 2 +- fs/open.c | 10 +-- fs/overlayfs/copy_up.c | 2 +- fs/overlayfs/file.c | 2 +- fs/overlayfs/overlayfs.h | 8 +-- fs/overlayfs/super.c | 2 +- fs/overlayfs/util.c | 8 +-- fs/pidfs.c | 2 +- fs/smb/server/vfs.c | 8 +-- fs/smb/server/vfs.h | 6 +- fs/stat.c | 2 +- include/linux/exportfs.h | 2 +- include/linux/fs.h | 9 ++- include/linux/namei.h | 2 +- kernel/acct.c | 96 ++++++++++---------------- kernel/trace/bpf_trace.c | 2 +- security/apparmor/af_unix.c | 14 ++-- tools/testing/selftests/bpf/bpf_experimental.h | 2 +- 25 files changed, 107 insertions(+), 133 deletions(-)
Quoted 2 lines · Al Viro
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.gitpull-f_path
I see the branch 'work.f_path', but no such tag. Forgot to push out?
Linus
Al Viro
maintainerQuoted 5 lines · Linus Torvalds
Quoted 2 lines · Al Viro
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.gitpull-f_pathI see the branch 'work.f_path', but no such tag. Forgot to push out?
D'oh... Sorry, pushed now. I wonder why this
git request-pull origin vfs pull-f_path >/tmp/y (straight from history) has not generated the usual warnings...
The pull request you sent on Fri, 3 Oct 2025 23:15:58 +0100:
The pull request you sent on Fri, 3 Oct 2025 23:15:58 +0100:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.gitpull-f_path
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/50647a1176b7abd1b4ae55b491eb2fbbeef89db9
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
Quoted 5 lines · Al Viro
----------------------------------------------------------------
file->f_pathconstificationSigned-off-by Al Viro <[email protected]>
Quoted 7 lines
----------------------------------------------------------------
Al Viro (24):
backing_file_user_path(): constify struct path * constify path argument ofvfs_statx_path()filename_lookup(): constify root argumentdone_path_create(): constify path argument bpf...d_path(): constify path argument
This commit broke bpf, since you didn't update include/uapi/linux/bpf.h and other places.
bpf mailing list was never cc-ed :(
Pushed the fix to bpf tree:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=de7342228b7343774d6a9981c2ddbfb5e201044b