Fail for disks which overflow upon usage calculation (#8056)

Fixes #8035
master
Harshavardhana 5 years ago committed by kannappanr
parent a48a034e5a
commit aaef18b1a3
  1. 8
      pkg/disk/stat_linux.go

@ -19,6 +19,7 @@
package disk package disk
import ( import (
"fmt"
"syscall" "syscall"
) )
@ -37,5 +38,12 @@ func GetInfo(path string) (info Info, err error) {
Ffree: uint64(s.Ffree), Ffree: uint64(s.Ffree),
FSType: getFSType(int64(s.Type)), FSType: getFSType(int64(s.Type)),
} }
// Check for overflows.
// https://github.com/minio/minio/issues/8035
// XFS can show wrong values at times error out
// in such scenarios.
if info.Free > info.Total {
return info, fmt.Errorf("detected free space (%d) > total disk space (%d), fs corruption at (%s). please run 'fsck'", info.Free, info.Total, path)
}
return info, nil return info, nil
} }

Loading…
Cancel
Save