re-use globalLocalDrives properly (#18721)

This commit is contained in:
Harshavardhana 2023-12-29 09:30:10 -08:00 committed by GitHub
parent 8a0ba093dd
commit 5b2ced0119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,9 +262,11 @@ func (s *erasureSets) connectDisks() {
s.erasureDisks[setIndex][diskIndex] = disk s.erasureDisks[setIndex][diskIndex] = disk
s.erasureDisksMu.Unlock() s.erasureDisksMu.Unlock()
globalLocalDrivesMu.Lock() if disk.IsLocal() && globalIsDistErasure {
globalLocalSetDrives[s.poolIndex][setIndex][diskIndex] = disk globalLocalDrivesMu.Lock()
globalLocalDrivesMu.Unlock() globalLocalSetDrives[s.poolIndex][setIndex][diskIndex] = disk
globalLocalDrivesMu.Unlock()
}
}(endpoint) }(endpoint)
} }
@ -403,6 +405,18 @@ func newErasureSets(ctx context.Context, endpoints PoolEndpoints, storageDisks [
if disk == nil { if disk == nil {
continue 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) innerWg.Add(1)
go func(disk StorageAPI, i, j int) { go func(disk StorageAPI, i, j int) {
defer innerWg.Done() defer innerWg.Done()