diff --git a/file_snapshot.go b/file_snapshot.go index 119bfd308..ffc941454 100644 --- a/file_snapshot.go +++ b/file_snapshot.go @@ -12,6 +12,7 @@ import ( "log" "os" "path/filepath" + "runtime" "sort" "strings" "time" @@ -406,17 +407,18 @@ func (s *FileSnapshotSink) Close() error { return err } - // fsync the parent directory, to sync directory edits to disk - parentFH, err := os.Open(s.parentDir) - defer parentFH.Close() - if err != nil { - s.logger.Printf("[ERR] snapshot: Failed to open snapshot parent directory %v, error: %v", s.parentDir, err) - return err - } + if runtime.GOOS != "windows" { //skipping fsync for directory entry edits on Windows, only needed for *nix style file systems + parentFH, err := os.Open(s.parentDir) + defer parentFH.Close() + if err != nil { + s.logger.Printf("[ERR] snapshot: Failed to open snapshot parent directory %v, error: %v", s.parentDir, err) + return err + } - if err = parentFH.Sync(); err != nil { - s.logger.Printf("[ERR] snapshot: Failed syncing parent directory %v, error: %v", s.parentDir, err) - return err + if err = parentFH.Sync(); err != nil { + s.logger.Printf("[ERR] snapshot: Failed syncing parent directory %v, error: %v", s.parentDir, err) + return err + } } // Reap any old snapshots