summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-10-13 18:01:36 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-10-26 10:44:20 +0200
commitab383be510ab2039042a89ae4fc3128eb8383cc4 (patch)
tree18a4067f4f59cc341072e423891bc1f21e075dc1
parentcb7a84486577a95c0300a12eb2e9cef4bd126628 (diff)
downloadlinux-stable-ab383be510ab2039042a89ae4fc3128eb8383cc4.tar.gz
linux-stable-ab383be510ab2039042a89ae4fc3128eb8383cc4.tar.bz2
linux-stable-ab383be510ab2039042a89ae4fc3128eb8383cc4.zip
f2fs: update ctx->pos correctly when hitting hole in directory
This patch fixes to update ctx->pos correctly when hitting hole in directory. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/dir.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 14646440b662..2d98d877c09d 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -870,7 +870,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
goto out_free;
}
- for (; n < npages; n++) {
+ for (; n < npages; n++, ctx->pos = n * NR_DENTRY_IN_BLOCK) {
/* allow readdir() to be interrupted */
if (fatal_signal_pending(current)) {
@@ -907,7 +907,6 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
break;
}
- ctx->pos = (n + 1) * NR_DENTRY_IN_BLOCK;
kunmap(dentry_page);
f2fs_put_page(dentry_page, 1);
}