lib/model: Add fsync of files and directories, option to disable (fixes #3711)

This commit is contained in:
Unrud
2016-11-21 18:09:29 +01:00
committed by Jakob Borg
parent 51e10e344d
commit 1574b7d834
8 changed files with 126 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ type FolderConfiguration struct {
MaxConflicts int `xml:"maxConflicts" json:"maxConflicts"`
DisableSparseFiles bool `xml:"disableSparseFiles" json:"disableSparseFiles"`
DisableTempIndexes bool `xml:"disableTempIndexes" json:"disableTempIndexes"`
Fsync bool `xml:"fsync" json:"fsync"`
cachedPath string
@@ -85,6 +86,9 @@ func (f *FolderConfiguration) CreateMarker() error {
return err
}
fd.Close()
if err := osutil.SyncDir(filepath.Dir(marker)); err != nil {
l.Infof("fsync %q failed: %v", filepath.Dir(marker), err)
}
osutil.HideFile(marker)
}