Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/lib/src/podstorage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ impl CStorage {
)
.context("labeling storage root")?;

// fsync so relabel writes are durable before creating the stamp file
rustix::fs::fsync(
self.storage_root
.reopen_as_ownedfd()
.context("Reopening as owned fd")?,
)
.context("fsync")?;

self.storage_root.create(LABELED)?;

// Label the stamp file itself to match the storage directory context
Expand All @@ -247,6 +255,14 @@ impl CStorage {
)
.context("labeling stamp file")?;

// fsync to persist the stamp file entry
rustix::fs::fsync(
self.storage_root
.reopen_as_ownedfd()
.context("Reopening as owned fd")?,
)
.context("fsync")?;

Ok(())
}

Expand Down
Loading