xl: Remove wrong wording for errCorruptedFormat (#18775)

Also add errCorruptedBackend to make it easier to differentiate between
corrupted content or something else wrong in the backend drive
This commit is contained in:
Anis Eleuch 2024-01-12 14:48:44 -08:00 committed by GitHub
parent 42cfdf246f
commit a47fc75c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 7 deletions

View File

@ -91,7 +91,7 @@ func diskErrToDriveState(err error) (state string) {
switch {
case errors.Is(err, errDiskNotFound) || errors.Is(err, context.DeadlineExceeded):
state = madmin.DriveStateOffline
case errors.Is(err, errCorruptedFormat):
case errors.Is(err, errCorruptedFormat) || errors.Is(err, errCorruptedBackend):
state = madmin.DriveStateCorrupt
case errors.Is(err, errUnformattedDisk):
state = madmin.DriveStateUnformatted

View File

@ -30,8 +30,11 @@ var errMaxVersionsExceeded = StorageErr("maximum versions exceeded, please delet
// errUnexpected - unexpected error, requires manual intervention.
var errUnexpected = StorageErr("unexpected error, please report this issue at https://github.com/minio/minio/issues")
// errCorruptedFormat - corrupted backend format.
var errCorruptedFormat = StorageErr("corrupted backend format, specified drive mount has unexpected previous content")
// errCorruptedFormat - corrupted format.
var errCorruptedFormat = StorageErr("corrupted format")
// errCorruptedBackend - corrupted backend.
var errCorruptedBackend = StorageErr("corrupted backend")
// errUnformattedDisk - unformatted disk found.
var errUnformattedDisk = StorageErr("unformatted drive found")

View File

@ -115,6 +115,8 @@ func toStorageErr(err error) error {
return errVolumeAccessDenied
case errCorruptedFormat.Error():
return errCorruptedFormat
case errCorruptedBackend.Error():
return errCorruptedBackend
case errUnformattedDisk.Error():
return errUnformattedDisk
case errInvalidAccessKeyID.Error():

View File

@ -779,12 +779,12 @@ func (s *xlStorage) checkFormatJSON() (os.FileInfo, error) {
return nil, errDiskAccessDenied
}
logger.LogOnceIf(GlobalContext, err, "check-format-json") // log unexpected errors
return nil, errCorruptedFormat
return nil, errCorruptedBackend
} else if osIsPermission(err) {
return nil, errDiskAccessDenied
}
logger.LogOnceIf(GlobalContext, err, "check-format-json") // log unexpected errors
return nil, errCorruptedFormat
return nil, errCorruptedBackend
}
return fi, nil
}
@ -830,12 +830,12 @@ func (s *xlStorage) GetDiskID() (string, error) {
return "", errDiskAccessDenied
}
logger.LogOnceIf(GlobalContext, err, "check-format-json") // log unexpected errors
return "", errCorruptedFormat
return "", errCorruptedBackend
} else if osIsPermission(err) {
return "", errDiskAccessDenied
}
logger.LogOnceIf(GlobalContext, err, "check-format-json") // log unexpected errors
return "", errCorruptedFormat
return "", errCorruptedBackend
}
format := &formatErasureV3{}