mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
protect tracker copy properly to avoid race (#18984)
```
WARNING: DATA RACE
Write at 0x00c000aac1e0 by goroutine 1133:
github.com/minio/minio/cmd.(*healingTracker).updateProgress()
github.com/minio/minio/cmd/background-newdisks-heal-ops.go:183 +0x117
github.com/minio/minio/cmd.(*erasureObjects).healErasureSet.func5()
github.com/minio/minio/cmd/global-heal.go:292 +0x1d3
Previous read at 0x00c000aac1e0 by goroutine 1003:
github.com/minio/minio/cmd.(*allHealState).updateHealStatus()
github.com/minio/minio/cmd/admin-heal-ops.go:136 +0xcb
github.com/minio/minio/cmd.(*healingTracker).save()
github.com/minio/minio/cmd/background-newdisks-heal-ops.go:223 +0x424
```
This commit is contained in:
@@ -133,7 +133,13 @@ func (ahs *allHealState) popHealLocalDisks(healLocalDisks ...Endpoint) {
|
||||
func (ahs *allHealState) updateHealStatus(tracker *healingTracker) {
|
||||
ahs.Lock()
|
||||
defer ahs.Unlock()
|
||||
ahs.healStatus[tracker.ID] = *tracker
|
||||
|
||||
tracker.mu.RLock()
|
||||
t := *tracker
|
||||
t.QueuedBuckets = append(make([]string, 0, len(tracker.QueuedBuckets)), tracker.QueuedBuckets...)
|
||||
t.HealedBuckets = append(make([]string, 0, len(tracker.HealedBuckets)), tracker.HealedBuckets...)
|
||||
ahs.healStatus[tracker.ID] = t
|
||||
tracker.mu.RUnlock()
|
||||
}
|
||||
|
||||
// Sort by zone, set and disk index
|
||||
|
||||
Reference in New Issue
Block a user