1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-07-03 23:56:41 +02:00

report nil instead of EOF for empty files

related to https://github.com/chrislusf/seaweedfs/issues/1541
This commit is contained in:
Chris Lu 2020-10-17 11:03:46 -07:00
parent 898db14729
commit c0ab458671

View file

@ -77,6 +77,10 @@ func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fus
totalRead = max(maxStop-req.Offset, totalRead)
}
if err == io.EOF {
err = nil
}
if err != nil {
glog.Warningf("file handle read %s %d: %v", fh.f.fullpath(), totalRead, err)
return fuse.EIO
@ -122,11 +126,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
totalRead, err := fh.f.reader.ReadAt(buff, offset)
if err == io.EOF {
err = nil
}
if err != nil {
if err != nil && err != io.EOF{
glog.Errorf("file handle read %s: %v", fh.f.fullpath(), err)
}