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.
Minor release: v2.6 #814
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
Uh oh!
There was an error while loading. Please reload this page.
Minor release: v2.6 #814
Changes from 1 commit
3ae87f456a9903d683f1c4b0aa629281ce292a600a64436935812d2b5ee4b054962829be0e6ad5a572ced679fbb0781f504a4232616161152b11f2b4a7e94f5b0a6d446cc6d4d9333ec92eee8eb08463fa368d3a01b11da61455b646896783f4f859552336e5279fc6c9a6e3a91200e6a208d84c7f70945a2ff17bfbe44e03c1a4e23fba40acdea181fcd82d11d6d1220ec0be4fe07389a0e3be7591d9cfb5814842d889e9507e62a2fb708274222b296c5afca66993490e1c4df283ae29cbafe3a33c37b2a2cc9559e1746fce9e51a07c2ce35e078bcc88f5f7349416c18b4df89d758eba55530b11ce0387cf6f65923cd397aa27a659c024a209340c781dd9990342c4b3e9d9b687ddcda2f6fd8e7ffbb0382fa2d2dd8bcfd4e601f37eb5801cf27c2147c41278ec152dd83091ad673b4091c62f26966d1b254dba1c7647b151e124795e6d5dc4876dc18c3e57402caae897fb0a4a44384a498b33a5b3bf045ddf0cc1db116332dca0da3d4c936009e28c753e25dfc0a7eca06f074eb2a18e0301ac033ee6a51be43d381363a8b5a99574c50b394c92298c7922a35bb6773e623a4a08dd03c2794d9e09259535e3dca029405f332File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There has been a bug in the filesystem for a while where truncating to a block boundary suffers from an off-by-one mistake that corrupts the internal representation of the CTZ skip-list. This mostly appears when the file_size == block_size, as file_size > block_size includes CTZ skip-list metadata, so the underlying block boundaries appear at slightly different offsets. --- The reason for off-by-one issue is a nuance in lfs_ctz_find that we sort of abuse to get two different behaviors. Consider the situation where this bug occurs: block 0 block 1 .--------. .--------. | abcdef |<-| {ptr0} | | ghijkl | | yzabcd | | mnopqr | | | | stuvwx | | | '--------' '--------' With these 24-byte blocks, there's an ambiguity if we wanted to point to offset 24. We could point before the block boundary, or we could point after the block boundary Before: block 0 block 1 .--------. .--------. | abcdef |<-| {ptr0} | | ghijkl | | yzabcd | | mnopqr | | | | stuvwx | | | '-------^' '--------' '-- off=24 is here After: block 0 block 1 .--------. .--------. | abcdef |<-| {ptr0} | | ghijkl | | yzabcd | | mnopqr | | ^ | | stuvwx | | | | '--------' '-|------' '-- off=24 is here When we want these two offsets depends on the context. We want the offset to be conservative if it represents a size, but eager if it is being used to prepare a block for writing. The workaround/hack is to prefer the eager offset, after the block boundary, but use `size-1` as the argument if we need the conservative offset. This finds the correct block, but is off-by-one in the calculated block-offset. Fortunately we happen to not use the block-offset in the places we need this workaround/hack. --- To get back to the bug, the wrong mode of lfs_ctz_find was used in lfs_file_truncate, leading to internal corruption of the CTZ skip-list. The correct behavior is size-1, with care to avoid underflow. Also I've tweaked the code to make it clear the calculated block-offset goes unused in these situations. Thanks to ghost, ajaybhargav, and others for reporting the issue, colin-foster-advantage for a reproducible test case, and rvanschoren, hgspbs for the initial solution.Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing