eventfs: Keep the directories from having the same inode number as files

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: 834bf76a ("eventfs: Save directory inodes in the eventfs_inode structure")
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent fa3889d9
...@@ -50,8 +50,12 @@ static struct eventfs_root_inode *get_root_inode(struct eventfs_inode *ei) ...@@ -50,8 +50,12 @@ static struct eventfs_root_inode *get_root_inode(struct eventfs_inode *ei)
/* Just try to make something consistent and unique */ /* Just try to make something consistent and unique */
static int eventfs_dir_ino(struct eventfs_inode *ei) static int eventfs_dir_ino(struct eventfs_inode *ei)
{ {
if (!ei->ino) if (!ei->ino) {
ei->ino = get_next_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; return ei->ino;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment