diff mbox series

[v1,08/10] NFS: Reset pagecache cursor on llseek

Message ID 24014d0e4f7119c76193eda5c5104a69bcaa30dd.1611160121.git.bcodding@redhat.com (mailing list archive)
State New
Headers show
Series NFS client readdir per-page validation | expand

Commit Message

Benjamin Coddington Jan. 20, 2021, 4:59 p.m. UTC
Unless we reset the cursor, a series of lseek() getdents() calls will
continue filling the pagecache indefinitely.  Instead, reset the cursor so
that we always start filling at the beginning of the pagecache.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index d6101e45fd66..7ca79d4b25ec 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1284,6 +1284,8 @@  static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
 			dir_ctx->pgc.index_cookie = offset;
 		else
 			dir_ctx->pgc.index_cookie = 0;
+		dir_ctx->pgc.page_index = 0;
+		dir_ctx->pgc.entry_index = 0;
 		if (offset == 0)
 			memset(dir_ctx->verf, 0, sizeof(dir_ctx->verf));
 		dir_ctx->duped = 0;