2021-01-20 17:07:04

by Benjamin Coddington

[permalink] [raw]
Subject: [PATCH v1 08/10] NFS: Reset pagecache cursor on llseek

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 <[email protected]>
---
fs/nfs/dir.c | 2 ++
1 file changed, 2 insertions(+)

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;
--
2.25.4