summaryrefslogtreecommitdiff
path: root/scripts/basic
diff options
context:
space:
mode:
authorPierre Barre <pierre@barre.sh>2026-05-12 16:20:32 +0300
committerDominique Martinet <asmadeus@codewreck.org>2026-05-19 14:58:18 +0300
commite661e17ddbed524b5fbda789a091b48b6b677067 (patch)
tree8d71adf135b1b0a31c530da59bff289748c32231 /scripts/basic
parentb4d71bea144550ff4a0917f8c4b06d4063eb27a6 (diff)
downloadlinux-e661e17ddbed524b5fbda789a091b48b6b677067.tar.xz
9p: invalidate readdir buffer on seek
The per-fid readdir buffer (fid->rdir) is populated lazily and only refilled when fully drained (rdir->head == rdir->tail). userspace lseek() on a directory fd updates file->f_pos via generic_file_llseek() but does not touch the cached buffer, so the next getdents() iterates the stale cache and emits entries from the previous position instead of the one the caller asked for. Track the file position the cached data corresponds to in struct p9_rdir, and drop the cache on entry to iterate_shared when it no longer matches ctx->pos. The 9p protocol's Tread/Treaddir already take an arbitrary offset on every request, so a refill at the new position is always legal; no .llseek override or seek restriction is needed. Reported-by: Pierre Barre <pierre@barre.sh> Link: https://lore.kernel.org/v9fs/496d10b9-40fe-4f81-8014-37497c37ff63@app.fastmail.com/ Signed-off-by: Pierre Barre <pierre@barre.sh> Message-ID: <20260512132032.369281-2-pierre@barre.sh> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions