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