mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 07:43:29 +03:00
fix: ReadFileStream should return an error when size mismatches (#13435)
offset+length should match the Size() of the individual parts return 'errFileCorrupt' otherwise, to trigger healing of the individual parts do not error out prematurely when healing such bitrot's upon successful parts being written to the client. another issue this PR fixes is to not return and error to the client if we have just triggered a heal on a specific part of the object, instead continue to read all the content and let the heal happen asynchronously later.
This commit is contained in:
@@ -1454,6 +1454,13 @@ func (s *xlStorage) ReadFileStream(ctx context.Context, volume, path string, off
|
||||
return nil, errIsNotRegular
|
||||
}
|
||||
|
||||
if st.Size() < offset+length {
|
||||
// Expected size cannot be satisfied for
|
||||
// requested offset and length
|
||||
file.Close()
|
||||
return nil, errFileCorrupt
|
||||
}
|
||||
|
||||
alignment := offset%xioutil.DirectioAlignSize == 0
|
||||
if !alignment {
|
||||
if err = disk.DisableDirectIO(file); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user