From a0e1163fb6247f6549894d72e17e0bbe32850df1 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 16 Jan 2024 15:13:14 -0800 Subject: [PATCH] reject reference format from a different deployment (#18800) reference format is constant for any lifetime of a minio cluster, we do not have to ever replace it during HealFormat() as it will never change. additionally we should simply reject reference formats that we do not understand early on. --- cmd/erasure-sets.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/erasure-sets.go b/cmd/erasure-sets.go index 7f83a2891..ea4f2efb7 100644 --- a/cmd/erasure-sets.go +++ b/cmd/erasure-sets.go @@ -1111,6 +1111,13 @@ func (s *erasureSets) HealFormat(ctx context.Context, dryRun bool) (res madmin.H return res, errNoHealRequired } + if !reflect.DeepEqual(s.format, refFormat) { + // Format is corrupted and unrecognized by the running instance. + logger.LogIf(ctx, fmt.Errorf("Unable to heal the newly replaced drives due to format.json inconsistencies, please engage MinIO support for further assistance: %w", + errCorruptedFormat)) + return res, errCorruptedFormat + } + formatOpID := mustGetUUID() // Initialize a new set of set formats which will be written to disk. @@ -1192,9 +1199,6 @@ func (s *erasureSets) HealFormat(ctx context.Context, dryRun bool) (res madmin.H } } - // Replace reference format with what was loaded from disks. - s.format = refFormat - s.erasureDisksMu.Unlock() }