Make sure to handle FaultyDisks in listing ops (#6204)

Continuing from PR 157ed65c35

Our posix.go implementation did not handle  I/O errors
properly on the disks, this led to situations where
top-level callers such as ListObjects might return early
without even verifying all the available disks.

This commit tries to address this in Kubernetes, drbd/nbd based
persistent volumes which can disconnect under load and
result in the situations with disks return I/O errors.

This commit also simplifies listing operation, listing
never returns any error. We can avoid this since we pretty
much ignore most of the errors anyways. When objects are
accessed directly we return proper errors.
This commit is contained in:
Harshavardhana
2018-07-27 15:32:19 -07:00
committed by kannappanr
parent 644c2ce326
commit ad86454580
11 changed files with 152 additions and 128 deletions

View File

@@ -24,22 +24,46 @@ import (
// Function not implemented error
func isSysErrNoSys(err error) bool {
return err == syscall.ENOSYS
if pathErr, ok := err.(*os.PathError); ok {
switch pathErr.Err {
case syscall.ENOSYS:
return true
}
}
return false
}
// Not supported error
func isSysErrOpNotSupported(err error) bool {
return err == syscall.EOPNOTSUPP
if pathErr, ok := err.(*os.PathError); ok {
switch pathErr.Err {
case syscall.EOPNOTSUPP:
return true
}
}
return false
}
// No space left on device error
func isSysErrNoSpace(err error) bool {
return err == syscall.ENOSPC
if pathErr, ok := err.(*os.PathError); ok {
switch pathErr.Err {
case syscall.ENOSPC:
return true
}
}
return false
}
// Input/output error
func isSysErrIO(err error) bool {
return err == syscall.EIO
if pathErr, ok := err.(*os.PathError); ok {
switch pathErr.Err {
case syscall.EIO:
return true
}
}
return false
}
// Check if the given error corresponds to EISDIR (is a directory).