Skip to content

Commit f49f950

Browse files
committed
eventfs: Make sure that parent->d_inode is locked in creating files/dirs
Since the locking of the parent->d_inode has been moved outside the creation of the files and directories (as it use to be locked via a conditional), add a WARN_ON_ONCE() to the case that it's not locked. Link: https://lkml.kernel.org/r/[email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Andrew Morton <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent fc45612 commit f49f950

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/tracefs/event_inode.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ create_file_dentry(struct eventfs_inode *ei, int idx,
327327
struct dentry **e_dentry = &ei->d_children[idx];
328328
struct dentry *dentry;
329329

330+
WARN_ON_ONCE(!inode_is_locked(parent->d_inode));
331+
330332
mutex_lock(&eventfs_mutex);
331333
if (ei->is_freed) {
332334
mutex_unlock(&eventfs_mutex);
@@ -430,6 +432,8 @@ create_dir_dentry(struct eventfs_inode *pei, struct eventfs_inode *ei,
430432
{
431433
struct dentry *dentry = NULL;
432434

435+
WARN_ON_ONCE(!inode_is_locked(parent->d_inode));
436+
433437
mutex_lock(&eventfs_mutex);
434438
if (pei->is_freed || ei->is_freed) {
435439
mutex_unlock(&eventfs_mutex);

0 commit comments

Comments
 (0)