From c2529260e7c989c8c9159f3e98eff111cd062a51 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 29 Apr 2020 13:42:37 -0700 Subject: [PATCH] fix: crash observed when position of drives different (#9490) allocate the disk slice properly before populating disk by its ID and its position. Fixes #9416 --- cmd/xl-sets.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/xl-sets.go b/cmd/xl-sets.go index 05ee14e25..4e0a5b26d 100644 --- a/cmd/xl-sets.go +++ b/cmd/xl-sets.go @@ -333,12 +333,15 @@ func newXLSets(ctx context.Context, endpoints Endpoints, storageDisks []StorageA for i := 0; i < setCount; i++ { s.xlDisks[i] = make([]StorageAPI, drivesPerSet) s.xlLockers[i] = make([]dsync.NetLocker, drivesPerSet) + } + for i := 0; i < setCount; i++ { var endpoints Endpoints for j := 0; j < drivesPerSet; j++ { endpoints = append(endpoints, s.endpoints[i*drivesPerSet+j]) // Rely on endpoints list to initialize, init lockers and available disks. s.xlLockers[i][j] = newLockAPI(s.endpoints[i*drivesPerSet+j]) + disk := storageDisks[i*drivesPerSet+j] if disk == nil { continue