Add comment for fsync

This commit is contained in:
Alex Auvolat 2022-03-14 11:54:00 +01:00
parent d78bf379fb
commit 0af314b295
No known key found for this signature in database
GPG Key ID: 0E496D15096376BE

View File

@ -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)