report error first

This commit is contained in:
Chris Lu 2020-08-16 23:49:10 -07:00
parent 2ac27616bc
commit f5837b7000

View file

@ -68,14 +68,14 @@ func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fus
totalRead = max(maxStop - req.Offset, totalRead)
}
totalRead = min(int64(len(buff)), totalRead)
resp.Data = buff[:totalRead]
if err != nil {
glog.Errorf("file handle read %s: %v", fh.f.fullpath(), err)
return fuse.EIO
}
totalRead = min(int64(len(buff)), totalRead)
resp.Data = buff[:totalRead]
return err
}