Send the lower level error directly from GetDiskID() (#10095)

this is to detect situations of corruption disk
format etc errors quickly and keep the disk online
in such scenarios for requests to fail appropriately.
This commit is contained in:
Harshavardhana
2020-07-21 13:54:06 -07:00
committed by GitHub
parent e464a5bfbc
commit a880283593
6 changed files with 47 additions and 49 deletions

View File

@@ -114,12 +114,18 @@ func (s *storageRESTServer) IsValid(w http.ResponseWriter, r *http.Request) bool
return true
}
storedDiskID, err := s.storage.GetDiskID()
if err == nil && diskID == storedDiskID {
// If format.json is available and request sent the right disk-id, we allow the request
return true
if err != nil {
s.writeErrorResponse(w, err)
return false
}
s.writeErrorResponse(w, errDiskStale)
return false
if diskID != storedDiskID {
s.writeErrorResponse(w, errDiskStale)
return false
}
// If format.json is available and request sent the right disk-id, we allow the request
return true
}
// HealthHandler handler checks if disk is stale