f2fs: return error of f2fs_lookup
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 27 May 2016 17:10:41 +0000 (10:10 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 3 Jun 2016 01:05:23 +0000 (18:05 -0700)
Now we can report an error to f2fs_lookup given by f2fs_find_entry.

Suggested-by: He YunLei <heyunlei@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c
fs/f2fs/namei.c

index ae37543f3840ecaea8227a10bdb47a0d21c35bd6..6fbb1ed182f6dbd0e83e9ff035d1983bf7cd3e46 100644 (file)
@@ -230,7 +230,7 @@ struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
 
        err = fscrypt_setup_filename(dir, child, 1, &fname);
        if (err) {
-               *res_page = ERR_PTR(-ENOMEM);
+               *res_page = ERR_PTR(err);
                return NULL;
        }
 
index 3f6119e94a78001c7a82528d58a9f507da854adb..78efe00a3a2fe0617d19deb9ff0cd6180ef4e795 100644 (file)
@@ -287,8 +287,11 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
                return ERR_PTR(-ENAMETOOLONG);
 
        de = f2fs_find_entry(dir, &dentry->d_name, &page);
-       if (!de)
+       if (!de) {
+               if (IS_ERR(page))
+                       return (struct dentry *)page;
                return d_splice_alias(inode, dentry);
+       }
 
        ino = le32_to_cpu(de->ino);
        f2fs_dentry_kunmap(dir, page);