Thread (17 messages) 17 messages, 4 authors, 2021-01-22
STALE2014d

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

From: Benjamin Coddington <hidden>
Date: 2021-01-20 17:05:26
Subsystem: filesystems (vfs and infrastructure), nfs, sunrpc, and lockd clients, the rest · Maintainers: Alexander Viro, Christian Brauner, Trond Myklebust, Anna Schumaker, Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help