Skip to content

Commit ab4d7ef

Browse files
rostedtroxanan1996
authored andcommitted
eventfs: Keep the directories from having the same inode number as files
BugLink: https://bugs.launchpad.net/bugs/2073788 commit 8898e7f 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/[email protected] Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Masahiro Yamada <[email protected]> Fixes: 834bf76 ("eventfs: Save directory inodes in the eventfs_inode structure") Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Portia Stephens <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent f9ab1bc commit ab4d7ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/tracefs/event_inode.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ static struct eventfs_root_inode *get_root_inode(struct eventfs_inode *ei)
5050
/* Just try to make something consistent and unique */
5151
static int eventfs_dir_ino(struct eventfs_inode *ei)
5252
{
53-
if (!ei->ino)
53+
if (!ei->ino) {
5454
ei->ino = get_next_ino();
55+
/* Must not have the file inode number */
56+
if (ei->ino == EVENTFS_FILE_INODE_INO)
57+
ei->ino = get_next_ino();
58+
}
5559

5660
return ei->ino;
5761
}

0 commit comments

Comments
 (0)