fix: Hold locks before closing all drives (#8818)

Fixes #8813
master
Harshavardhana 5 years ago committed by GitHub
parent d8660b30cc
commit 9be7066715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      cmd/xl-sets.go

@ -234,8 +234,6 @@ func (s *xlSets) monitorAndConnectEndpoints(monitorInterval time.Duration) {
func (s *xlSets) GetLockers(setIndex int) func() []dsync.NetLocker {
return func() []dsync.NetLocker {
s.xlDisksMu.Lock()
defer s.xlDisksMu.Unlock()
lockers := make([]dsync.NetLocker, s.drivesPerSet)
copy(lockers, s.xlLockers[setIndex])
return lockers
@ -1301,7 +1299,9 @@ func (s *xlSets) ReloadFormat(ctx context.Context, dryRun bool) (err error) {
s.format = refFormat
// Close all existing disks and reconnect all the disks.
s.xlDisksMu.Lock()
s.xlDisks.Close()
s.xlDisksMu.Unlock()
s.connectDisks()
// Restart monitoring loop to monitor reformatted disks again.
@ -1488,7 +1488,9 @@ func (s *xlSets) HealFormat(ctx context.Context, dryRun bool) (res madmin.HealRe
s.format = refFormat
// Disconnect/relinquish all existing disks, lockers and reconnect the disks, lockers.
s.xlDisksMu.Lock()
s.xlDisks.Close()
s.xlDisksMu.Unlock()
s.connectDisks()
// Restart our monitoring loop to start monitoring newly formatted disks.

Loading…
Cancel
Save