summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-03-05 19:25:20 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2020-04-02 07:09:28 +0200
commitf7bb959d9623ddf9fe9cc44234c210051548ea18 (patch)
tree73b7d2217d7f0e10f5d0a3400ceda5415d6c19e0 /fs
parenttake post-lookup part of do_last() out of loop (diff)
downloadlinux-f7bb959d9623ddf9fe9cc44234c210051548ea18.tar.xz
linux-f7bb959d9623ddf9fe9cc44234c210051548ea18.zip
open_last_lookups(): consolidate fsnotify_create() calls
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 329ade345e62..6cb41608c47c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2957,8 +2957,6 @@ static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry,
dput(dentry);
dentry = dget(file->f_path.dentry);
}
- if (file->f_mode & FMODE_CREATED)
- fsnotify_create(dir, dentry);
} else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) {
error = -EIO;
} else {
@@ -2966,8 +2964,6 @@ static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry,
dput(dentry);
dentry = file->f_path.dentry;
}
- if (file->f_mode & FMODE_CREATED)
- fsnotify_create(dir, dentry);
if (unlikely(d_is_negative(dentry)))
error = -ENOENT;
}
@@ -3103,7 +3099,6 @@ no_open:
open_flag & O_EXCL);
if (error)
goto out_dput;
- fsnotify_create(dir_inode, dentry);
}
if (unlikely(create_error) && !dentry->d_inode) {
error = create_error;
@@ -3182,6 +3177,8 @@ static const char *open_last_lookups(struct nameidata *nd,
else
inode_lock_shared(dir->d_inode);
dentry = lookup_open(nd, file, op, got_write);
+ if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED))
+ fsnotify_create(dir->d_inode, dentry);
if (open_flag & O_CREAT)
inode_unlock(dir->d_inode);
else