fix race between fuse_iget() and fuse_reverse_inval_inode()#75
Closed
hbirth wants to merge 2 commits into
Closed
Conversation
This reverts commit fabde09.
There is a race condition where fuse_reverse_inval_inode() can be called while fuse_iget() is still initializing an inode. This can lead to the inode's attributes being invalidated before they are properly set up, causing inconsistent state. The race occurs when: 1. Thread A calls fuse_iget() and starts initializing an inode 2. Thread B calls fuse_reverse_inval_inode() for the same inode 3. Thread B updates attr_version, invalidating the inode 4. Thread A completes initialization with stale attributes This patch fixes the race by introducing a delayed invalidation mechanism: - Use attr_version == 1 as a sentinel value to indicate that an invalidation occurred during fuse_iget() initialization - In fuse_change_attributes_common(), skip updating attr_version if it equals 1, allowing fuse_iget() to detect the pending invalidation - In fuse_reverse_inval_inode_common(), if attr_version <= 1, set it to 1 and return early, deferring the invalidation - In fuse_iget(), after calling fuse_change_attributes(), check if attr_version == 1 and perform the delayed invalidation The function fuse_reverse_inval_inode() is refactored to extract the common invalidation logic into fuse_reverse_inval_inode_common() Since fc->attr_version is initialized to 1, normal inode attr_version values will be 0 (for new inodes before first update) or >= 2, making the value 1 safe to use as a sentinel. Signed-off-by: Guang Yuan Wu <gwu@ddn.com> Applied-by: Horst Birthelmer <hbirthelmer@ddn.com>
bsbernd
requested changes
Jan 14, 2026
Collaborator
bsbernd
left a comment
There was a problem hiding this comment.
Sorry no, we cannot fix an issue between clients and cause another issue on the local client.
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.
No description provided.