dedupe: stop instead of spinning when a round makes no progress (#396/#407) - #408
Open
martinus wants to merge 1 commit into
Open
dedupe: stop instead of spinning when a round makes no progress (#396/#407)#408martinus wants to merge 1 commit into
martinus wants to merge 1 commit into
Conversation
…fasheh#396/markfasheh#407) The dedupe ioctl loop requeues any request the kernel didn't finish. If a round deduped zero bytes but returned no error (status 0), every request was requeued unchanged and the next identical ioctl returned the same zero - an infinite loop at 100% CPU, reported as hangs on 0.15. Break out when a full round moves no bytes and requests are still queued, splicing them to completed (accounted as not-deduped) rather than looping forever. Productive dedupe always advances >0 bytes per round - a large extent progresses in fs-block chunks - so this never cuts real work short. Fixes: markfasheh#396 Fixes: markfasheh#407 Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What this fixes
The dedupe ioctl loop requeues any request the kernel didn't fully finish. If a round deduped zero bytes but returned no error (
info[i].status == 0), every still-queued request was requeued unchanged — and the next identicalFIDEDUPERANGEreturns the same zero. That's an infinite loop.What happens without the fix
duperemovehangs, pinning a CPU core at 100% and never completing the run. It's been reported as hangs on 0.15.x (#396, #407).The fix
After each round, sum the bytes deduped. If a full round moved no bytes while requests are still queued, stop: splice the stuck requests onto the completed list (accounted as not-deduped) instead of reissuing the same no-op ioctl forever.
Productive dedupe always advances >0 bytes per round — a large extent progresses in fs-block chunks — so this never cuts real work short. Verified a 256 MB extent (8 rounds) still fully shares, and the guard never fired across the integration suite.
Fixes: #396
Fixes: #407