mirror of
https://github.com/deepseek-ai/3FS.git
synced 2026-11-05 00:47:47 +00:00
[PR #379] [MERGED] fix: Fix AvailSlots(AtomicSharedPtrTable) dealloc() slot cleanup logic #401
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/3FS#401
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/3FS/pull/379
Author: @qieqieplus
Created: 1/14/2026
Status: ✅ Merged
Merged: 1/14/2026
Merged by: @SF-Zhou
Base:
main← Head:main📝 Commits (1)
847edc6fix(AtomicSharedPtrTable): Fix AvailSlots dealloc() slot cleanup logic📊 Changes
1 file changed (+12 additions, -14 deletions)
View changed files
📝
src/common/utils/AtomicSharedPtrTable.h(+12 -14)📄 Description
Bug: AvailSlots::dealloc fails to erase reclaimed indices from free set
The original code
Issue 1: Loop condition checks the wrong index
The loop checks free.find(--nextAvail). But after the decrement, nextAvail == idx (the index being deallocated right now), which should never be in free. The condition is always false on first iteration, so the loop never executes.
Issue 2: Never erases from free
Even if the loop did execute, it only calls find() without erase(). Indices would remain in free while also being implicitly available (below nextAvail), leading to double allocation.
These two errors together created a state where the code technically avoided double allocations but failed its primary purpose. Because the loop exited immediately, it only decremented nextAvail by one. The other contiguous free slots (e.g., 0 and 1) remained in the free set.
Minimal demo to reproduce the issue:
Other Minor Fixes:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.