Skip to content

{bp-19811} fs/cromfs: Fix stale cache read in read() fast path. - #19827

Merged
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19811
Aug 13, 2026
Merged

{bp-19811} fs/cromfs: Fix stale cache read in read() fast path.#19827
xiaoxiang781216 merged 1 commit into
apache:releases/13.0from
jerpelea:bp-19811

Conversation

@jerpelea

Copy link
Copy Markdown
Contributor

Summary

cromfs_read()'s fast path decompresses a block directly into the caller's buffer whenever a read reaches a block at its start and the caller has room for the whole decompressed block, bypassing the per-file decompression cache (ff_buffer). It nonetheless marked that block as cached by setting ff_offset, without ever writing ff_buffer itself.

A later read of the same block that fell onto the slow path trusted that false cache tag, skipped decompression, and copied from ff_buffer without it ever having been populated for that block. A repeated identical fast-path read of the same block hit the same false tag and skipped decompression entirely, leaving the caller's buffer untouched and returning whatever was already there.

Fixed by having the fast path only read the cache, never populate it: reuse ff_buffer when a prior slow-path read already cached the same block, otherwise decompress straight into the caller's buffer without touching ff_offset/ff_buffer.

Impact

RELEASE

Testing

CI

cromfs_read()'s fast path decompresses a block directly into the
caller's buffer whenever a read reaches a block at its start and the
caller has room for the whole decompressed block, bypassing the
per-file decompression cache (ff_buffer). It nonetheless marked that
block as cached by setting ff_offset, without ever writing ff_buffer
itself.

A later read of the same block that fell onto the slow path trusted
that false cache tag, skipped decompression, and copied from
ff_buffer without it ever having been populated for that block. A
repeated identical fast-path read of the same block hit the same
false tag and skipped decompression entirely, leaving the caller's
buffer untouched and returning whatever was already there.

Fixed by having the fast path only read the cache, never populate it:
reuse ff_buffer when a prior slow-path read already cached the same
block, otherwise decompress straight into the caller's buffer without
touching ff_offset/ff_buffer.

Co-authored-by: Pavlo
Assisted-by: Claude Code:claude-sonnet-5
Signed-off-by: alexcekay <alexander@auterion.com>
@github-actions github-actions Bot added Area: File System File System issues Size: S The size of the change in this PR is small labels Aug 13, 2026
@jerpelea

Copy link
Copy Markdown
Contributor Author

do not restart Ci until #19814 is merged

@xiaoxiang781216
xiaoxiang781216 merged commit 2688f94 into apache:releases/13.0 Aug 13, 2026
7 of 13 checks passed
@jerpelea
jerpelea deleted the bp-19811 branch August 13, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: File System File System issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants