From af4c1fb7a3f428ff704af22294ad955d05ed41dd Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 14 Oct 2020 00:35:16 +0200 Subject: 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 . --- internal/syscallcompat/sys_linux.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'internal/syscallcompat/sys_linux.go') diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go index 6273504..06b9696 100644 --- a/internal/syscallcompat/sys_linux.go +++ b/internal/syscallcompat/sys_linux.go @@ -265,9 +265,13 @@ func FutimesNano(fd int, a *time.Time, m *time.Time) (err error) { } // UtimesNanoAtNofollow is like UtimesNanoAt but never follows symlinks. +// Retries on EINTR. func UtimesNanoAtNofollow(dirfd int, path string, a *time.Time, m *time.Time) (err error) { ts := timesToTimespec(a, m) - return unix.UtimesNanoAt(dirfd, path, ts, unix.AT_SYMLINK_NOFOLLOW) + err = retryEINTR(func() error { + return unix.UtimesNanoAt(dirfd, path, ts, unix.AT_SYMLINK_NOFOLLOW) + }) + return err } // Getdents syscall. @@ -276,6 +280,10 @@ func Getdents(fd int) ([]fuse.DirEntry, error) { } // Renameat2 does not exist on Darwin, so we have to wrap it here. +// Retries on EINTR. func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { - return unix.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags) + err = retryEINTR(func() error { + return unix.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags) + }) + return err } -- cgit v1.2.3