Print log when EINVALID is encountered in storage layer (#13341)

EINVALID from the OS is not a common case and should be logger.
This commit is contained in:
Anis Elleuch 2021-10-04 17:01:52 +01:00 committed by GitHub
parent 94d587e6fc
commit f5be8ba11f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,12 @@
package cmd package cmd
import "errors" import (
"context"
"errors"
"github.com/minio/minio/internal/logger"
)
// errUnexpected - unexpected error, requires manual intervention. // errUnexpected - unexpected error, requires manual intervention.
var errUnexpected = StorageErr("unexpected error, please report this issue at https://github.com/minio/minio/issues") var errUnexpected = StorageErr("unexpected error, please report this issue at https://github.com/minio/minio/issues")
@ -157,6 +162,7 @@ func osErrToFileErr(err error) error {
return errFaultyDisk return errFaultyDisk
} }
if isSysErrInvalidArg(err) { if isSysErrInvalidArg(err) {
logger.LogIf(context.Background(), err)
// For some odd calls with O_DIRECT reads // For some odd calls with O_DIRECT reads
// filesystems can return EINVAL, handle // filesystems can return EINVAL, handle
// these as FileNotFound instead. // these as FileNotFound instead.