syscallcompat: warn when Getdents truncates data

On CIFS mounts, unix.Getdents can return sudden ENOENT
in the middle of data. This will not be reported as an error
by user space tools, so return EIO instead.

Also log it as a warning.

https://github.com/rfjakob/gocryptfs/issues/483
This commit is contained in:
Jakob Unterwurzacher 2020-05-24 23:30:25 +02:00
parent b3350f0ebb
commit 15ff79bf14
1 changed files with 4 additions and 0 deletions

View File

@ -42,6 +42,10 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
}
continue
} else if err != nil {
if smartBuf.Len() > 0 {
tlog.Warn.Printf("warning: unix.Getdents returned errno %d in the middle of data", err.(syscall.Errno))
return nil, syscall.EIO
}
return nil, err
}
if n == 0 {