fix: prevent apply_commit from clobbering size/hash on generation mismatch#75
Merged
fix: prevent apply_commit from clobbering size/hash on generation mismatch#75
Conversation
…match When a concurrent writer advances the dirty generation while a flush is in flight, apply_commit would overwrite size and xet_hash with the stale flushed values before checking the generation. This caused applications to see the wrong file size until the next flush. Move size/hash/pending_deletes updates inside the clear_dirty_if success branch so they are only applied when the generation matches.
Benchmark Results |
POSIX Compliance (pjdfstest) |
XciD
added a commit
that referenced
this pull request
Mar 26, 2026
Bump version to 0.1.1. ## Changes since v0.1.0 ### Bug fixes - fix: prevent file descriptor exhaustion on bulk NFS deletes (#68) - fix: schedule flush after NFS exclusive create with empty files (#71) - fix: re-check dirty status before poll deletes inode, TOCTOU race (#67) - fix: prevent poll from deleting inodes with open file handles (#74) - fix: prevent apply_commit from clobbering size/hash on generation mismatch (#75) - fix: serialize setattr truncate with write to prevent inode size race (#76) - fix: tolerate rename Phase 3 failure after remote mutation (#77) ### Performance - perf: chunk upload_files to bound FD usage during flush (#72) - perf: skip redundant HEAD revalidation after flush commit (#73)
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.
Summary
Fixes REVIEW.md finding 3 in #69 :
apply_commitoverwrotesizeandxet_hashunconditionally before checkingclear_dirty_if(dirty_generation). If a concurrent writer advanced the generation, the in-progress file's size was clobbered with the stale flushed value.Scenario:
apply_commit("hash", 10MB, gen=5)runssize=10MB, thenclear_dirty_if(5)returns false (gen is 6)Fix: Move
xet_hash,size, andpending_deletes.clear()inside theclear_dirty_ifsuccess branch.One-line semantic change in
src/virtual_fs/inode.rs, existing test updated.