From e0f8b767ba91ea827cd6c53451d8b70d55c40ac1 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 5 Sep 2018 10:20:54 -0700 Subject: [PATCH] Fail for critical errors early on during prepare storage (#6404) --- cmd/prepare-storage.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/prepare-storage.go b/cmd/prepare-storage.go index c25f1f0e7..edc7d5f8c 100644 --- a/cmd/prepare-storage.go +++ b/cmd/prepare-storage.go @@ -129,6 +129,12 @@ func connectLoadInitFormats(firstDisk bool, endpoints EndpointList, setCount, dr // Attempt to load all `format.json` from all disks. formatConfigs, sErrs := loadFormatXLAll(storageDisks) + // Check if we have + for i, sErr := range sErrs { + if _, ok := formatCriticalErrors[sErr]; ok { + return nil, fmt.Errorf("Disk %s: %s", endpoints[i], sErr) + } + } // Pre-emptively check if one of the formatted disks // is invalid. This function returns success for the @@ -139,12 +145,6 @@ func connectLoadInitFormats(firstDisk bool, endpoints EndpointList, setCount, dr return nil, err } - for i, sErr := range sErrs { - if _, ok := formatCriticalErrors[sErr]; ok { - return nil, fmt.Errorf("Disk %s: %s", endpoints[i], sErr) - } - } - // All disks report unformatted we should initialized everyone. if shouldInitXLDisks(sErrs) && firstDisk { return initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet)