From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758110AbdJMKCR (ORCPT ); Fri, 13 Oct 2017 06:02:17 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8034 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758096AbdJMKCP (ORCPT ); Fri, 13 Oct 2017 06:02:15 -0400 From: Chao Yu To: CC: , , , Chao Yu Subject: [PATCH 5/5] f2fs: update ctx->pos correctly when hitting hole in directory Date: Fri, 13 Oct 2017 18:01:36 +0800 Message-ID: <20171013100136.35212-5-yuchao0@huawei.com> X-Mailer: git-send-email 2.13.1.388.g69e6b9b4f4a9 In-Reply-To: <20171013100136.35212-1-yuchao0@huawei.com> References: <20171013100136.35212-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0201.59E08F15.00AC,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 4adda2d1a45d736c1ae83f63c1ca50a0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes to update ctx->pos correctly when hitting hole in directory. Signed-off-by: Chao Yu --- fs/f2fs/dir.c | 3 +-- 1 file changed, 1 insertion(+), 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); } -- 2.13.1.388.g69e6b9b4f4a9