fusefrontend: doWrite: report readFileID errors as I/O error

It used to be reported as "function not implemented", accompanied
with this log output:

  go-fuse: can't convert error type: ParseHeader: header is all-zero. Header hexdump: 000000000000000000000000000000000000

Now we report EIO and log this:

  doWrite 1372183: corrupt header: ParseHeader: header is all-zero. Header hexdump: 000000000000000000000000000000000000
master
Jakob Unterwurzacher 2023-01-24 22:07:28 +01:00
parent e9a5b8962b
commit 85297cda97
1 changed files with 4 additions and 0 deletions

View File

@ -273,6 +273,10 @@ func (f *File) doWrite(data []byte, off int64) (uint32, syscall.Errno) {
if err == io.EOF {
fileID, err = f.createHeader()
fileWasEmpty = true
} else if err != nil {
// Other errors mean readFileID() found a corrupt header
tlog.Warn.Printf("doWrite %d: corrupt header: %v", f.qIno.Ino, err)
return 0, syscall.EIO
}
if err != nil {
return 0, fs.ToErrno(err)