f2fs: fix to report error in f2fs_readdir
authorChao Yu <chao2.yu@samsung.com>
Thu, 19 Nov 2015 08:09:07 +0000 (16:09 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 4 Dec 2015 19:52:35 +0000 (11:52 -0800)
get_lock_data_page in f2fs_readdir can fail due to a lot of reasons (i.e.
no memory or IO error...), it's better to report this kind of error to
user rather than ignoring it.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/dir.c

index 7c1678ba8f9265c98df78d16d18c7510aeafa1a4..9de898d2ddff3f547158f8280b41ba99663972e3 100644 (file)
@@ -855,8 +855,13 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
 
        for (; n < npages; n++) {
                dentry_page = get_lock_data_page(inode, n, false);
-               if (IS_ERR(dentry_page))
-                       continue;
+               if (IS_ERR(dentry_page)) {
+                       err = PTR_ERR(dentry_page);
+                       if (err == -ENOENT)
+                               continue;
+                       else
+                               goto out;
+               }
 
                dentry_blk = kmap(dentry_page);