Browse Source

report nil instead of EOF for empty files

related to https://github.com/chrislusf/seaweedfs/issues/1541
pull/1547/head
Chris Lu 4 years ago
parent
commit
c0ab458671
  1. 10
      weed/filesys/filehandle.go

10
weed/filesys/filehandle.go

@ -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)
}

Loading…
Cancel
Save