2f04e20627
A user on the forum was seeing the error "bad message", which was not very helpful. This case from the ext4 filesystem using the code EBADMSG to indicate it detected an invalid CRC, suggesting disk corruption. This change adds some explanatory information about probable disk corruption to all errors coming from the (*blobInfo).Stat() call, which is where storagenode fs corruption problems will usually manifest. Refs: https://github.com/storj/storj/issues/5375 Change-Id: I87f4a800236050415c4191ef1a0fc952f9def315
24 lines
460 B
Go
24 lines
460 B
Go
// Copyright (C) 2023 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
//go:build !unix
|
|
// +build !unix
|
|
|
|
package filestore
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func isLowLevelCorruptionError(err error) bool {
|
|
// convert to lowercase the perr.Op because Go returns inconsistently
|
|
// "lstat" in Linux and "Lstat" in Windows
|
|
var perr *os.PathError
|
|
if errors.As(err, &perr) && strings.ToLower(perr.Op) == "lstat" {
|
|
return true
|
|
}
|
|
return false
|
|
}
|