Skip to content

Commit

Permalink
re-use globalLocalDrives properly (minio#18721)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Dec 29, 2023
1 parent 8a0ba09 commit 5b2ced0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions cmd/erasure-sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ func (s *erasureSets) connectDisks() {
s.erasureDisks[setIndex][diskIndex] = disk
s.erasureDisksMu.Unlock()

globalLocalDrivesMu.Lock()
globalLocalSetDrives[s.poolIndex][setIndex][diskIndex] = disk
globalLocalDrivesMu.Unlock()
if disk.IsLocal() && globalIsDistErasure {
globalLocalDrivesMu.Lock()
globalLocalSetDrives[s.poolIndex][setIndex][diskIndex] = disk
globalLocalDrivesMu.Unlock()
}
}(endpoint)
}

Expand Down Expand Up @@ -403,6 +405,18 @@ func newErasureSets(ctx context.Context, endpoints PoolEndpoints, storageDisks [
if disk == nil {
continue
}

if disk.IsLocal() && globalIsDistErasure {
globalLocalDrivesMu.RLock()
ldisk := globalLocalSetDrives[poolIdx][i][j]
if ldisk == nil {
globalLocalDrivesMu.RUnlock()
continue
}
disk = ldisk
globalLocalDrivesMu.RUnlock()
}

innerWg.Add(1)
go func(disk StorageAPI, i, j int) {
defer innerWg.Done()
Expand Down

0 comments on commit 5b2ced0

Please sign in to comment.