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
28 lines
450 B
Go
28 lines
450 B
Go
// Copyright (C) 2023 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
//go:build unix
|
|
|
|
package filestore
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
func isLowLevelCorruptionError(err error) bool {
|
|
var perr *os.PathError
|
|
if errors.As(err, &perr) && perr.Op == "lstat" {
|
|
return true
|
|
}
|
|
var errnoErr syscall.Errno
|
|
if errors.As(err, &errnoErr) {
|
|
switch errnoErr {
|
|
case syscall.EBADMSG, syscall.EIO:
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|