From 630963fa6bd0072acd07f7cb3966857b10735107 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 6 Feb 2024 08:56:59 -0800 Subject: [PATCH] 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 ``` --- .github/workflows/multipart/migrate.sh | 2 +- buildscripts/rewrite-old-new.sh | 2 +- cmd/admin-heal-ops.go | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/multipart/migrate.sh b/.github/workflows/multipart/migrate.sh index 534e512f6..3057bbf3e 100755 --- a/.github/workflows/multipart/migrate.sh +++ b/.github/workflows/multipart/migrate.sh @@ -26,7 +26,7 @@ fi ( cd /tmp - go install github.com/minio/minio/docs/debugging/s3-check-md5@latest + go install github.com/minio/minio/docs/debugging/s3-check-md5@master ) export RELEASE=RELEASE.2023-08-29T23-07-35Z diff --git a/buildscripts/rewrite-old-new.sh b/buildscripts/rewrite-old-new.sh index 5d0c2b706..aa22ab747 100755 --- a/buildscripts/rewrite-old-new.sh +++ b/buildscripts/rewrite-old-new.sh @@ -87,7 +87,7 @@ function verify_rewrite() { exit 1 fi - go install github.com/minio/minio/docs/debugging/s3-check-md5@latest + go install github.com/minio/minio/docs/debugging/s3-check-md5@master if ! s3-check-md5 \ -debug \ -versions \ diff --git a/cmd/admin-heal-ops.go b/cmd/admin-heal-ops.go index ffbc9c0c5..7e4d1652a 100644 --- a/cmd/admin-heal-ops.go +++ b/cmd/admin-heal-ops.go @@ -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