mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 15:17:25 +00:00
all: Ignore Sync errors on directories (fixes #4432)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4449
This commit is contained in:
parent
b1ade6d0c0
commit
622b614f31
@ -96,7 +96,7 @@ func (f *FolderConfiguration) CreateMarker() error {
|
||||
}
|
||||
if dir, err := fs.Open("."); err == nil {
|
||||
if serr := dir.Sync(); err != nil {
|
||||
l.Infof("fsync %q failed: %v", ".", serr)
|
||||
l.Debugln("fsync %q failed: %v", ".", serr)
|
||||
}
|
||||
} else {
|
||||
l.Infof("fsync %q failed: %v", ".", err)
|
||||
|
@ -317,22 +317,6 @@ func (f fsFile) Stat() (FileInfo, error) {
|
||||
return fsFileInfo{info}, nil
|
||||
}
|
||||
|
||||
func (f fsFile) Sync() error {
|
||||
err := f.File.Sync()
|
||||
if err == nil || runtime.GOOS != "windows" {
|
||||
return err
|
||||
}
|
||||
// On Windows, fsyncing a directory returns a "handle is invalid" (localized so can't check for strings)
|
||||
// So we swallow that and let things go through in order not to have to add
|
||||
// a separate way of syncing directories versus files.
|
||||
if stat, serr := f.Stat(); serr != nil {
|
||||
return serr
|
||||
} else if stat.IsDir() {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// fsFileInfo implements the fs.FileInfo interface on top of an os.FileInfo.
|
||||
type fsFileInfo struct {
|
||||
os.FileInfo
|
||||
|
@ -1543,11 +1543,11 @@ func (f *sendReceiveFolder) dbUpdaterRoutine() {
|
||||
delete(changedDirs, dir)
|
||||
fd, err := f.fs.Open(dir)
|
||||
if err != nil {
|
||||
l.Infof("fsync %q failed: %v", dir, err)
|
||||
l.Debugf("fsync %q failed: %v", dir, err)
|
||||
continue
|
||||
}
|
||||
if err := fd.Sync(); err != nil {
|
||||
l.Infof("fsync %q failed: %v", dir, err)
|
||||
l.Debugf("fsync %q failed: %v", dir, err)
|
||||
}
|
||||
fd.Close()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user