add object api check in fs-v1 before returning ready (#9285)

fs-v1 in server mode only checks to see if the path exist, so that it
returns ready before it is indeed ready.

This change adds a check to ensure that the global object api is
available too before reporting ready.

Fixes #9283
This commit is contained in:
Pontus Leitzler 2020-04-08 17:53:20 +02:00 committed by GitHub
parent 44decbeae0
commit a973402821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1392,6 +1392,13 @@ func (fs *FSObjects) IsCompressionSupported() bool {
// IsReady - Check if the backend disk is ready to accept traffic. // IsReady - Check if the backend disk is ready to accept traffic.
func (fs *FSObjects) IsReady(_ context.Context) bool { func (fs *FSObjects) IsReady(_ context.Context) bool {
_, err := os.Stat(fs.fsPath) if _, err := os.Stat(fs.fsPath); err != nil {
return err == nil return false
}
globalObjLayerMutex.RLock()
res := globalObjectAPI != nil && !globalSafeMode
globalObjLayerMutex.RUnlock()
return res
} }