-
Notifications
You must be signed in to change notification settings - Fork 237
Fix EXT4 extent offset double-counting causing block address overflow #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| fillExtents( | ||
| node: &leafNode, numExtents: extentsInBlock, numBlocks: dataBlocks, | ||
| start: blocks.start + offset, | ||
| start: blocks.start, //Fixed: removed '+ offset' to prevent double-counting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to include the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcantah ill remove the comment thank you so much
|
@Ronitsabhaya75 This does look wrong, but do you actually see this fixes these warnings? I remember trialing a very similar fix a week or so ago and didn't seem like much changed. I haven't had much time to dig back in |
|
@dcantah I haven't been able to test it yet because I'm on macOS 15.6 and the project requires macOS 26+. However, I'm confident this is the root cause based on the math: The bug: Line 1137 passes extentStart = (blocks.start + offset) + (offset + i * MaxBlocksPerExtent)
= blocks.start + 2*offset + ... For extent block iteration 5231: offset = 856,842,240 Double-counted: extentStart = 1,713,685,480 (matches the 1,710,731,624 error!) Filesystem max: 134,217,728 blocks (way exceeded!) |
|
The math I agree with, I just vaguely remember still seeing these warnings even with a similar (possibly the exact same) fix. I'll give it a whirl |
for sure Um we can test it and check if there are warnings i can have deeper look into it. thank you @dcantah for reviewing |
Closes #441
current behavior:
EXT4 filesystem corruption occurs when creating large files in containers, causing block addresses to exceed maximum inode values. This results in errors like:
EXT4-fs warning (device vdb): ext4_block_to_path:105: block 1710731624 > max in inode 21209237The fix:
Remove the pre-added offset. Connect to the correct block address immediately by passing blocks.start directly, allowing offset to be applied once inside
fillExtents. This ensures block addresses remain within filesystem bounds for files of any size.