summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2023-01-24 22:07:28 +0100
committerJakob Unterwurzacher2023-02-21 22:08:41 +0100
commit85297cda97d018b514361a2088a78f50f1446f95 (patch)
tree691b29c5f760c9efa1796a44ef387db13631ed15
parente9a5b8962b0fc128acb95b75c2aabc0894d3e4ba (diff)
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
-rw-r--r--internal/fusefrontend/file.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go
index 2f111fd..ff26a6e 100644
--- a/internal/fusefrontend/file.go
+++ b/internal/fusefrontend/file.go
@@ -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)