aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-03-14 11:54:00 +0100
committerAlex Auvolat <alex@adnab.me>2022-03-14 11:54:00 +0100
commit0af314b295f70fdf107524b08063f4d36fb4eeb6 (patch)
tree7b67d1bf8230d7cc2f373192323a3bf24afa9cf8
parentd78bf379fb85c0264c9971a26724f8b933a234ee (diff)
downloadgarage-0af314b295f70fdf107524b08063f4d36fb4eeb6.tar.gz
garage-0af314b295f70fdf107524b08063f4d36fb4eeb6.zip
Add comment for fsync
-rw-r--r--src/model/block.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/model/block.rs b/src/model/block.rs
index 8329bb6f..a41daa64 100644
--- a/src/model/block.rs
+++ b/src/model/block.rs
@@ -902,6 +902,11 @@ impl BlockManagerLocked {
fs::remove_file(to_delete).await?;
}
+ // We want to ensure that when this function returns, data is properly persisted
+ // to disk. The first step is the sync_all above that does an fsync on the data file.
+ // Now, we do an fsync on the containing directory, to ensure that the rename
+ // is persisted properly. See:
+ // http://thedjbway.b0llix.net/qmail/syncdir.html
let dir = fs::OpenOptions::new()
.read(true)
.mode(0)