aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/open_nofollow.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-10-14 00:35:16 +0200
committerJakob Unterwurzacher2020-10-14 00:35:16 +0200
commitaf4c1fb7a3f428ff704af22294ad955d05ed41dd (patch)
tree66bdf7480ff1dd82bf2653c2070871762f24d742 /internal/syscallcompat/open_nofollow.go
parent803fdf410bb57d34ef09357ec4924646978c20b5 (diff)
syscallcompat: retry ops on EINTR
Retry operations that have been shown to throw EINTR errors on CIFS. Todo: Solution for this pain in the back: warning: unix.Getdents returned errno 2 in the middle of data rm: cannot remove 'linux-3.0.old3/Documentation/ABI/removed': Input/output error Progress towards fixing https://github.com/rfjakob/gocryptfs/issues/483 .
Diffstat (limited to 'internal/syscallcompat/open_nofollow.go')
-rw-r--r--internal/syscallcompat/open_nofollow.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/syscallcompat/open_nofollow.go b/internal/syscallcompat/open_nofollow.go
index a1e7cce..f8e50e3 100644
--- a/internal/syscallcompat/open_nofollow.go
+++ b/internal/syscallcompat/open_nofollow.go
@@ -13,6 +13,7 @@ import (
// This function is implemented by walking the directory tree, starting at
// "baseDir", using the Openat syscall with the O_NOFOLLOW flag.
// Symlinks that are part of the "baseDir" path are followed.
+// Retries on EINTR.
func OpenDirNofollow(baseDir string, relPath string) (fd int, err error) {
if !filepath.IsAbs(baseDir) {
tlog.Warn.Printf("BUG: OpenDirNofollow called with relative baseDir=%q", baseDir)
@@ -23,7 +24,9 @@ func OpenDirNofollow(baseDir string, relPath string) (fd int, err error) {
return -1, syscall.EINVAL
}
// Open the base dir (following symlinks)
- dirfd, err := syscall.Open(baseDir, syscall.O_DIRECTORY|O_PATH, 0)
+ dirfd, err := retryEINTR2(func() (int, error) {
+ return syscall.Open(baseDir, syscall.O_DIRECTORY|O_PATH, 0)
+ })
if err != nil {
return -1, err
}