Skip to content

dedupe: stop instead of spinning when a round makes no progress (#396/#407) - #408

Open
martinus wants to merge 1 commit into
markfasheh:masterfrom
martinus:backport/dedupe-zero-progress
Open

dedupe: stop instead of spinning when a round makes no progress (#396/#407)#408
martinus wants to merge 1 commit into
markfasheh:masterfrom
martinus:backport/dedupe-zero-progress

Conversation

@martinus

Copy link
Copy Markdown

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 identical FIDEDUPERANGE returns the same zero. That's an infinite loop.

What happens without the fix

duperemove hangs, 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

…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

duperemove 0.15.2 hangs 0.15.2 infinite loop during deduping

1 participant