From: Yunlong Song Date: Wed, 27 Apr 2016 12:32:37 +0000 (+0800) Subject: f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir X-Git-Tag: v4.7-rc1~84^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe216c7a0ff993cdac885109d8544ba02e6f9127;p=platform%2Fkernel%2Flinux-exynos.git f2fs: fix to return 0 if err == -ENOENT in f2fs_readdir 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 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 3b1c14e..dbfc1d1 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -888,6 +888,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;