]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
f2fs: update ctx->pos correctly when hitting hole in directory
authorChao Yu <yuchao0@huawei.com>
Fri, 13 Oct 2017 10:01:36 +0000 (18:01 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 26 Oct 2017 08:44:20 +0000 (10:44 +0200)
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>
fs/f2fs/dir.c

index 14646440b662e4ce8d162051bbce64718d370d67..2d98d877c09dada99dfae36b45f85b3da75af095 100644 (file)
@@ -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);
        }