gfs2_atomic_open(): skip lookups on hashed dentry
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Sep 2014 22:21:05 +0000 (18:21 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Oct 2014 06:39:15 +0000 (02:39 -0400)
hashed dentry can be passed to ->atomic_open() only if
a) it has just passed revalidation and
b) it's negative

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/gfs2/inode.c

index fc8ac2ee0667c8d66082aa48f05f9acee452a8ac..8108b4f0354ce8aab3d9a3e010687ed2f0688454 100644 (file)
@@ -1244,6 +1244,9 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
        struct dentry *d;
        bool excl = !!(flags & O_EXCL);
 
+       if (!d_unhashed(dentry))
+               goto skip_lookup;
+
        d = __gfs2_lookup(dir, dentry, file, opened);
        if (IS_ERR(d))
                return PTR_ERR(d);
@@ -1260,6 +1263,8 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
        }
 
        BUG_ON(d != NULL);
+
+skip_lookup:
        if (!(flags & O_CREAT))
                return -ENOENT;