Downgrade MULTI sentinel in rev_host_clear#68
Open
ChuWeiChang wants to merge 1 commit into
Open
Conversation
host_to_vfd stayed MULTI even after all but one VFD aliasing a host FD had closed, breaking reverse lookups for the survivor. Add host_fd_refs to track share counts: on close, decrement and, when the count falls to 1, search for the surviving VFD and restore a direct mapping instead of leaving MULTI in place. Change-Id: I196608b0dfe31492786928f71ba4a1e4801fc532
00005dc to
0000cbd
Compare
Contributor
Author
|
|
Contributor
DONE. Make test script more robust. |
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.
As stated in #38 (comment), MULTI sentinel in
host_to_vfd[]is never recover to vfd once it is set. This PR fixes it by adding a per-host-FD reference counthost_fd_refs[]that tracks how many VFDs alias each host FD:rev_host_setincrements the count before writing the slot.rev_host_cleardecrements it on close. When the count falls to 1, it searches for the surviving VFD and writes it directly intohost_to_vfd, downgrading MULTI back to a valid mapping. When the count reaches 0, the slot is cleared toKBOX_HOST_VFD_NONEas before.A new unit test
test-fd-table-refcount.ccovers the single-holder, two-sharer, and downgrade cases.Summary by cubic
Fixes stale MULTI entries in the reverse host-FD map by tracking per-host FD refs and downgrading back to a direct mapping when only one VFD remains. Restores correct reverse lookups after shared FDs are closed.
Written for commit 0000cbd. Summary will update on new commits.