From baa30f4289433602f886084aa2688846f9559701 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 20 May 2020 14:11:13 -0700 Subject: [PATCH] reload bucket metadata outside the locker (#9659) --- cmd/bucket-metadata-sys.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/bucket-metadata-sys.go b/cmd/bucket-metadata-sys.go index 9ff826235..71bc746df 100644 --- a/cmd/bucket-metadata-sys.go +++ b/cmd/bucket-metadata-sys.go @@ -258,9 +258,9 @@ func (sys *BucketMetadataSys) GetConfig(bucket string) (BucketMetadata, error) { return newBucketMetadata(bucket), errInvalidArgument } - sys.Lock() - defer sys.Unlock() + sys.RLock() meta, ok := sys.metadataMap[bucket] + sys.RUnlock() if ok { return meta, nil } @@ -268,7 +268,9 @@ func (sys *BucketMetadataSys) GetConfig(bucket string) (BucketMetadata, error) { if err != nil { return meta, err } + sys.Lock() sys.metadataMap[bucket] = meta + sys.Unlock() return meta, nil }