Skip to content

Commit

Permalink
fusefrontend: doWrite: report readFileID errors as I/O error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rfjakob committed Feb 21, 2023
1 parent e9a5b89 commit 85297cd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/fusefrontend/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 85297cd

Please sign in to comment.