Skip to content

Commit 2819f23

Browse files
committed
eventfs: Use eventfs_remove_events_dir()
The update to removing the eventfs_file changed the way the events top level directory was handled. Instead of returning a dentry, it now returns the eventfs_inode. In this changed, the removing of the events top level directory is not much different than removing any of the other directories. Because of this, the removal just called eventfs_remove_dir() instead of eventfs_remove_events_dir(). Although eventfs_remove_dir() does the clean up, it misses out on the dget() of the ei->dentry done in eventfs_create_events_dir(). It makes more sense to match eventfs_create_events_dir() with a specific function eventfs_remove_events_dir() and this specific function can then perform the dput() to the dentry that had the dget() when it was created. Fixes: 5790b1f ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202310051743.y9EobbUr-lkp@intel.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent f5d9e8e commit 2819f23

3 files changed

Lines changed: 9 additions & 13 deletions

File tree

fs/tracefs/event_inode.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -901,22 +901,17 @@ void eventfs_remove_dir(struct eventfs_inode *ei)
901901
}
902902

903903
/**
904-
* eventfs_remove_events_dir - remove eventfs dir or file from list
905-
* @dentry: events's dentry to be removed.
904+
* eventfs_remove_events_dir - remove the top level eventfs directory
905+
* @ei: the event_inode returned by eventfs_create_events_dir().
906906
*
907-
* This function remove events main directory
907+
* This function removes the events main directory
908908
*/
909-
void eventfs_remove_events_dir(struct dentry *dentry)
909+
void eventfs_remove_events_dir(struct eventfs_inode *ei)
910910
{
911-
struct tracefs_inode *ti;
912-
913-
if (!dentry || !dentry->d_inode)
914-
return;
911+
struct dentry *dentry = ei->dentry;
915912

916-
ti = get_tracefs(dentry->d_inode);
917-
if (!ti || !(ti->flags & TRACEFS_EVENT_INODE))
918-
return;
913+
eventfs_remove_dir(ei);
919914

920-
d_invalidate(dentry);
915+
/* Matches the dget() from eventfs_create_events_dir() */
921916
dput(dentry);
922917
}

include/linux/tracefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
4141
const struct eventfs_entry *entries,
4242
int size, void *data);
4343

44+
void eventfs_remove_events_dir(struct eventfs_inode *ei);
4445
void eventfs_remove_dir(struct eventfs_inode *ei);
4546

4647
struct dentry *tracefs_create_file(const char *name, umode_t mode,

kernel/trace/trace_events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3872,7 +3872,7 @@ int event_trace_del_tracer(struct trace_array *tr)
38723872

38733873
down_write(&trace_event_sem);
38743874
__trace_remove_event_dirs(tr);
3875-
eventfs_remove_dir(tr->event_dir);
3875+
eventfs_remove_events_dir(tr->event_dir);
38763876
up_write(&trace_event_sem);
38773877

38783878
tr->event_dir = NULL;

0 commit comments

Comments
 (0)