Commit 57b62d29ad5b384775974973087d47755a8c6fcc ("f2fs: fix to report
error in f2fs_readdir") causes f2fs_readdir to return -ENOENT when
get_lock_data_page returns -ENOENT. However, the original logic is to
continue when get_lock_data_page returns -ENOENT, but it forgets to
reset err to 0.

This will cause getdents64 incorretly return -ENOENT when lastdirent is
NULL in getdents64. This will lead to a wrong return value for syscall
caller.

Signed-off-by: Yunlong Song <[email protected]>
---
 fs/f2fs/dir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 0ad7b9a..3ed6145 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -886,6 +886,7 @@ static int f2fs_readdir(struct file *file, struct 
dir_context *ctx)
                kunmap(dentry_page);
                f2fs_put_page(dentry_page, 1);
        }
+       err = 0;
 out:
        fscrypt_fname_free_buffer(&fstr);
        return err;
-- 
1.8.5.2


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to