From 111c02770e594ce5034e8cc37cda30cfa5106ac8 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Tue, 6 Apr 2021 20:33:10 +0200 Subject: [PATCH] Fix data race when connecting disks (#11983) Multiple disks from the same set would be writing concurrently. ``` WARNING: DATA RACE Write at 0x00c002100ce0 by goroutine 166: github.com/minio/minio/cmd.(*erasureSets).connectDisks.func1() d:/minio/minio/cmd/erasure-sets.go:254 +0x82f Previous write at 0x00c002100ce0 by goroutine 129: github.com/minio/minio/cmd.(*erasureSets).connectDisks.func1() d:/minio/minio/cmd/erasure-sets.go:254 +0x82f Goroutine 166 (running) created at: github.com/minio/minio/cmd.(*erasureSets).connectDisks() d:/minio/minio/cmd/erasure-sets.go:210 +0x324 github.com/minio/minio/cmd.(*erasureSets).monitorAndConnectEndpoints() d:/minio/minio/cmd/erasure-sets.go:288 +0x244 Goroutine 129 (finished) created at: github.com/minio/minio/cmd.(*erasureSets).connectDisks() d:/minio/minio/cmd/erasure-sets.go:210 +0x324 github.com/minio/minio/cmd.(*erasureSets).monitorAndConnectEndpoints() d:/minio/minio/cmd/erasure-sets.go:288 +0x244 ``` --- cmd/erasure-sets.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/erasure-sets.go b/cmd/erasure-sets.go index ddc736d8a..deedf4a94 100644 --- a/cmd/erasure-sets.go +++ b/cmd/erasure-sets.go @@ -250,8 +250,8 @@ func (s *erasureSets) connectDisks() { } disk.SetDiskLoc(s.poolIndex, setIndex, diskIndex) s.endpointStrings[setIndex*s.setDriveCount+diskIndex] = disk.String() - s.erasureDisksMu.Unlock() setsJustConnected[setIndex] = true + s.erasureDisksMu.Unlock() }(endpoint) }