diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2024-05-23 08:14:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-06-16 14:47:47 +0300 |
commit | 4e84ead3f60a4b3b25e2486e5f8708186349d778 (patch) | |
tree | 6b23481ff3c154b6aad826172bd2250101de5a0c | |
parent | 5ade5fbdbbb1f023bb70730ba4d74146c8bc7eb9 (diff) | |
download | linux-4e84ead3f60a4b3b25e2486e5f8708186349d778.tar.xz |
eventfs: Keep the directories from having the same inode number as files
commit 8898e7f288c47d450a3cf1511c791a03550c0789 upstream.
The directories require unique inode numbers but all the eventfs files
have the same inode number. Prevent the directories from having the same
inode numbers as the files as that can confuse some tooling.
Link: https://lore.kernel.org/linux-trace-kernel/20240523051539.428826685@goodmis.org
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Fixes: 834bf76add3e6 ("eventfs: Save directory inodes in the eventfs_inode structure")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/tracefs/event_inode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 94518a039a99..b521e904a7ce 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -50,8 +50,12 @@ static struct eventfs_root_inode *get_root_inode(struct eventfs_inode *ei) /* Just try to make something consistent and unique */ static int eventfs_dir_ino(struct eventfs_inode *ei) { - if (!ei->ino) + if (!ei->ino) { ei->ino = get_next_ino(); + /* Must not have the file inode number */ + if (ei->ino == EVENTFS_FILE_INODE_INO) + ei->ino = get_next_ino(); + } return ei->ino; } |