ext4: fix wrong span for an internal node's last child - #420
Merged
deitch merged 1 commit intoAug 3, 2026
Merged
Conversation
extentInternalNode.findBlocks and .blocks() called parseExtents with an inclusive end block in its count argument, but parseExtents' internal-node branch treats that argument as an actual count (start+count marks one past the end) when deriving the span of a node's last child -- real ext4 index entries don't store a count on disk, so the last entry's span has to come from the caller. The mismatch silently dropped the final file block of any range reaching the last child of a node loaded this way. .blocks() reads were unaffected in practice: leaf-node parsing ignores the start/count arguments entirely, so a wrong count only mattered when it was also passed down to a child's own findBlocks call. findBlocks itself isn't wired up to any current caller, so this had no observable effect until something exercises it directly (e.g. a range read added on top of the existing full-file read path). Pass the child's actual count instead of computing an end block, matching the one caller (loadChildNode) that already did this correctly. Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extentInternalNode.findBlocks and .blocks() called parseExtents with an inclusive end block in its count argument, but parseExtents' internal-node branch treats that argument as an actual count (start+count marks one past the end) when deriving the span of a node's last child -- real ext4 index entries don't store a count on disk, so the last entry's span has to come from the caller. The mismatch silently dropped the final file block of any range reaching the last child of a node loaded this way.
.blocks() reads were unaffected in practice: leaf-node parsing ignores the start/count arguments entirely, so a wrong count only mattered when it was also passed down to a child's own findBlocks call. findBlocks itself isn't wired up to any current caller, so this had no observable effect until something exercises it directly (e.g. a range read added on top of the existing full-file read path).
Pass the child's actual count instead of computing an end block, matching the one caller (loadChildNode) that already did this correctly.