]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs: store real path instead of fake path in backing file f_path
authorAmir Goldstein <amir73il@gmail.com>
Mon, 9 Oct 2023 15:37:12 +0000 (18:37 +0300)
committerChristian Brauner <brauner@kernel.org>
Thu, 19 Oct 2023 09:03:15 +0000 (11:03 +0200)
commitdef3ae83da02f87005210fa3d448c5dd37ba4105
tree3205fda67f49682217cef7e8d09b79a590294a69
parent08582d678fcf11fc86188f0b92239d3d49667d8e
fs: store real path instead of fake path in backing file f_path

A backing file struct stores two path's, one "real" path that is referring
to f_inode and one "fake" path, which should be displayed to users in
/proc/<pid>/maps.

There is a lot more potential code that needs to know the "real" path, then
code that needs to know the "fake" path.

Instead of code having to request the "real" path with file_real_path(),
store the "real" path in f_path and require code that needs to know the
"fake" path request it with file_user_path().
Replace the file_real_path() helper with a simple const accessor f_path().

After this change, file_dentry() is not expected to observe any files
with overlayfs f_path and real f_inode, so the call to ->d_real() should
not be needed.  Leave the ->d_real() call for now and add an assertion
in ovl_d_real() to catch if we made wrong assumptions.

Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
Link: https://lore.kernel.org/r/CAJfpegtt48eXhhjDFA1ojcHPNKj3Go6joryCPtEFAKpocyBsnw@mail.gmail.com/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/r/20231009153712.1566422-4-amir73il@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/file_table.c
fs/internal.h
fs/open.c
fs/overlayfs/super.c
include/linux/fs.h
include/linux/fsnotify.h