mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
heal: Check for truncated files (#10399)
When checking parts we already do a stat for each part. Since we have the on disk size check if it is at least what we expect. When checking metadata check if metadata is 0 bytes.
This commit is contained in:
parent
a89d6b8e3d
commit
3e1fb17b70
@ -1812,6 +1812,10 @@ func (s *xlStorage) CheckParts(volume, path string, fi FileInfo) error {
|
|||||||
if st.Mode().IsDir() {
|
if st.Mode().IsDir() {
|
||||||
return errFileNotFound
|
return errFileNotFound
|
||||||
}
|
}
|
||||||
|
// Check if shard is truncated.
|
||||||
|
if st.Size() < fi.Erasure.ShardFileSize(part.Size) {
|
||||||
|
return errFileCorrupt
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -1860,7 +1864,7 @@ func (s *xlStorage) CheckFile(volume, path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If its a directory its not a regular file.
|
// If its a directory its not a regular file.
|
||||||
if st.Mode().IsDir() {
|
if st.Mode().IsDir() || st.Size() == 0 {
|
||||||
return errFileNotFound
|
return errFileNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user