f2fs: fix to avoid unneeded unlock_new_inode
authorChao Yu <chao@kernel.org>
Thu, 10 Mar 2016 14:24:23 +0000 (22:24 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 18 Mar 2016 04:19:46 +0000 (21:19 -0700)
During ->lookup, I_NEW state of inode was been cleared in f2fs_iget,
so in error path, we don't need to clear it again.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/namei.c

index 7b07a4799952093e7ce21dd5feecee017b9bfba2..7876f10521019509bbae2888addea516e8cc1db2 100644 (file)
@@ -308,13 +308,13 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
                        !fscrypt_has_permitted_context(dir, inode)) {
                bool nokey = f2fs_encrypted_inode(inode) &&
                        !fscrypt_has_encryption_key(inode);
-               iput(inode);
-               return nokey ? ERR_PTR(-ENOKEY) : ERR_PTR(-EPERM);
+               err = nokey ? -ENOKEY : -EPERM;
+               goto err_out;
        }
        return d_splice_alias(inode, dentry);
 
 err_out:
-       iget_failed(inode);
+       iput(inode);
        return ERR_PTR(err);
 }