From 48a0d83143df8fcfe347704dfd656bf5c6b982f9 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Wed, 11 May 2022 20:37:59 +0200 Subject: [PATCH] local: Ignore additional errors for directory syncing Apparently SMB/CIFS on Linux/macOS returns somewhat random errnos when trying to sync a windows share which does not support calling fsync for a directory. --- changelog/unreleased/issue-3720 | 13 +++++++++++++ internal/backend/local/local_unix.go | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/issue-3720 diff --git a/changelog/unreleased/issue-3720 b/changelog/unreleased/issue-3720 new file mode 100644 index 000000000..3044a5c4c --- /dev/null +++ b/changelog/unreleased/issue-3720 @@ -0,0 +1,13 @@ +Bugfix: Fix directory sync errors related repositories accessed via SMB + +On Linux and macOS accessing a repository via a SMB/CIFS mount resulted in +restic failing to save the lock file: + +Save() returned error, retrying after 552.330144ms: sync /repo/locks: no such file or directory +Save() returned error, retrying after 552.330144ms: sync /repo/locks: invalid argument + +This has been fixed by ignoring these error codes. + +https://github.com/restic/restic/issues/3720 +https://github.com/restic/restic/issues/3751 +https://github.com/restic/restic/pull/3752 diff --git a/internal/backend/local/local_unix.go b/internal/backend/local/local_unix.go index 6e1298796..3dde753a8 100644 --- a/internal/backend/local/local_unix.go +++ b/internal/backend/local/local_unix.go @@ -19,7 +19,7 @@ func fsyncDir(dir string) error { } err = d.Sync() - if errors.Is(err, syscall.ENOTSUP) { + if errors.Is(err, syscall.ENOTSUP) || errors.Is(err, syscall.ENOENT) || errors.Is(err, syscall.EINVAL) { err = nil }