Skip to content

Commit f7bb959

Browse files
author
Al Viro
committed
open_last_lookups(): consolidate fsnotify_create() calls
Signed-off-by: Al Viro <[email protected]>
1 parent c5971b8 commit f7bb959

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fs/namei.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,17 +2957,13 @@ static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry,
29572957
dput(dentry);
29582958
dentry = dget(file->f_path.dentry);
29592959
}
2960-
if (file->f_mode & FMODE_CREATED)
2961-
fsnotify_create(dir, dentry);
29622960
} else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) {
29632961
error = -EIO;
29642962
} else {
29652963
if (file->f_path.dentry) {
29662964
dput(dentry);
29672965
dentry = file->f_path.dentry;
29682966
}
2969-
if (file->f_mode & FMODE_CREATED)
2970-
fsnotify_create(dir, dentry);
29712967
if (unlikely(d_is_negative(dentry)))
29722968
error = -ENOENT;
29732969
}
@@ -3103,7 +3099,6 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
31033099
open_flag & O_EXCL);
31043100
if (error)
31053101
goto out_dput;
3106-
fsnotify_create(dir_inode, dentry);
31073102
}
31083103
if (unlikely(create_error) && !dentry->d_inode) {
31093104
error = create_error;
@@ -3182,6 +3177,8 @@ static const char *open_last_lookups(struct nameidata *nd,
31823177
else
31833178
inode_lock_shared(dir->d_inode);
31843179
dentry = lookup_open(nd, file, op, got_write);
3180+
if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED))
3181+
fsnotify_create(dir->d_inode, dentry);
31853182
if (open_flag & O_CREAT)
31863183
inode_unlock(dir->d_inode);
31873184
else

0 commit comments

Comments
 (0)