소스 검색

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>
Chao Yu 8 년 전
부모
커밋
ab383be510
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 2
      fs/f2fs/dir.c

+ 1 - 2
fs/f2fs/dir.c

@@ -870,7 +870,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
 		goto out_free;
 		goto out_free;
 	}
 	}
 
 
-	for (; n < npages; n++) {
+	for (; n < npages; n++, ctx->pos = n * NR_DENTRY_IN_BLOCK) {
 
 
 		/* allow readdir() to be interrupted */
 		/* allow readdir() to be interrupted */
 		if (fatal_signal_pending(current)) {
 		if (fatal_signal_pending(current)) {
@@ -907,7 +907,6 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
 			break;
 			break;
 		}
 		}
 
 
-		ctx->pos = (n + 1) * NR_DENTRY_IN_BLOCK;
 		kunmap(dentry_page);
 		kunmap(dentry_page);
 		f2fs_put_page(dentry_page, 1);
 		f2fs_put_page(dentry_page, 1);
 	}
 	}