podstorage: fsync storage root before and after creating .bootc_labeled#2066
Open
andrewdunndev wants to merge 1 commit intobootc-dev:mainfrom
Open
podstorage: fsync storage root before and after creating .bootc_labeled#2066andrewdunndev wants to merge 1 commit intobootc-dev:mainfrom
andrewdunndev wants to merge 1 commit intobootc-dev:mainfrom
Conversation
Sync the storage root directory after relabeling to ensure the label writes are durable before creating the stamp file, and again after creating and labeling the stamp file to persist the directory entry. This avoids a crash leaving the system in a state where the stamp exists but the relabeling writes were lost. Closes: bootc-dev#1210 Signed-off-by: Andrew Dunn <andrew@dunn.dev>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces fsync calls to ensure_labeled() to improve crash resilience, which is a good improvement. The implementation correctly adds fsync before creating the .bootc_labeled stamp file and after labeling it to ensure data durability. My only suggestion is to refactor the duplicated fsync logic into a helper function to improve code maintainability.
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.
Adds fsync calls to
ensure_labeled()in podstorage to improve crash resilience around the.bootc_labeledstamp file, as suggested in #1210.The storage root directory is synced after relabeling (so the label writes are durable before the stamp is created) and again after creating and labeling the stamp file (so the directory entry is persisted). This prevents a crash from leaving the system in a state where the stamp exists but the relabeling writes were lost, which would cause the relabeling to be silently skipped on next boot.
Uses the existing
reopen_as_ownedfd()+rustix::fs::fsync()pattern to work around the O_PATH fd limitation on cap-std directories.Closes #1210