From a97340282114adf4b1b399a7a57292ca82c0b423 Mon Sep 17 00:00:00 2001 From: Pontus Leitzler Date: Wed, 8 Apr 2020 17:53:20 +0200 Subject: [PATCH] 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 --- cmd/fs-v1.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/fs-v1.go b/cmd/fs-v1.go index becea0bcc..81008b533 100644 --- a/cmd/fs-v1.go +++ b/cmd/fs-v1.go @@ -1392,6 +1392,13 @@ func (fs *FSObjects) IsCompressionSupported() bool { // IsReady - Check if the backend disk is ready to accept traffic. func (fs *FSObjects) IsReady(_ context.Context) bool { - _, err := os.Stat(fs.fsPath) - return err == nil + if _, err := os.Stat(fs.fsPath); err != nil { + return false + } + + globalObjLayerMutex.RLock() + res := globalObjectAPI != nil && !globalSafeMode + globalObjLayerMutex.RUnlock() + + return res }