mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
fix: ignore faulty drives and continue (#10511)
drives might return different types of errors handle them individually, and for some errors just log an error and continue
This commit is contained in:
@@ -176,15 +176,6 @@ func getValidPath(path string, requireDirectIO bool) (string, error) {
|
||||
return path, errDiskNotDir
|
||||
}
|
||||
|
||||
di, err := getDiskInfo(path)
|
||||
if err != nil {
|
||||
return path, err
|
||||
}
|
||||
|
||||
if err = checkDiskMinTotal(di); err != nil {
|
||||
return path, err
|
||||
}
|
||||
|
||||
// check if backend is writable.
|
||||
var rnd [8]byte
|
||||
_, _ = rand.Read(rnd[:])
|
||||
@@ -195,6 +186,7 @@ func getValidPath(path string, requireDirectIO bool) (string, error) {
|
||||
var file *os.File
|
||||
|
||||
if requireDirectIO {
|
||||
// only erasure coding needs direct-io support
|
||||
file, err = disk.OpenFileDirectIO(fn, os.O_CREATE|os.O_EXCL, 0666)
|
||||
} else {
|
||||
file, err = os.OpenFile(fn, os.O_CREATE|os.O_EXCL, 0666)
|
||||
@@ -204,12 +196,22 @@ func getValidPath(path string, requireDirectIO bool) (string, error) {
|
||||
// if direct i/o failed.
|
||||
if err != nil {
|
||||
if isSysErrInvalidArg(err) {
|
||||
// O_DIRECT not supported
|
||||
return path, errUnsupportedDisk
|
||||
}
|
||||
return path, err
|
||||
return path, osErrToFileErr(err)
|
||||
}
|
||||
file.Close()
|
||||
|
||||
di, err := getDiskInfo(path)
|
||||
if err != nil {
|
||||
return path, err
|
||||
}
|
||||
|
||||
if err = checkDiskMinTotal(di); err != nil {
|
||||
return path, err
|
||||
}
|
||||
|
||||
return path, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user