Fix locking in some admin APIs: (#5438)

- read lock for get config
- write lock for update creds
- write lock for format file
This commit is contained in:
Aditya Manthramurthy
2018-01-22 18:09:12 -08:00
committed by Harshavardhana
parent a003de72bf
commit 254b05e314
2 changed files with 26 additions and 0 deletions

View File

@@ -528,6 +528,13 @@ func (h *healSequence) healDiskFormat() error {
return errServerNotInitialized
}
// Acquire lock on format.json
formatLock := globalNSMutex.NewNSLock(minioMetaBucket, formatConfigFile)
if err := formatLock.GetLock(globalHealingTimeout); err != nil {
return errFnHealFromAPIErr(err)
}
defer formatLock.Unlock()
// Create a new set of storage instances to heal format.json.
bootstrapDisks, err := initStorageDisks(globalEndpoints)
if err != nil {