fix: O_DIRECT is on only for multi-disk setups (#18194)

Disable it for single disk/unsupported platforms
This commit is contained in:
Aditya Manthramurthy 2023-10-09 17:08:40 -07:00 committed by GitHub
parent 11544a62aa
commit 2b4531f069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,18 +290,15 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
s.formatLegacy = format.Erasure.DistributionAlgo == formatErasureVersionV2DistributionAlgoV1
}
// Return an error if ODirect is not supported unless it is a single erasure
// disk mode
if err := s.checkODirectDiskSupport(); err == nil {
// Return an error if ODirect is not supported. Single disk will have
// oDirect off.
if globalIsErasureSD || !disk.ODirectPlatform {
s.oDirect = false
} else if err := s.checkODirectDiskSupport(); err == nil {
s.oDirect = true
} else {
// Allow if unsupported platform or single disk.
if errors.Is(err, errUnsupportedDisk) && globalIsErasureSD || !disk.ODirectPlatform {
s.oDirect = false
} else {
return s, err
}
}
// Success.
return s, nil