diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index f95ed3398..c8653c767 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -433,6 +433,12 @@ func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object s return fi, nil, nil, err } + // if one of the disk is offline, return right here no need + // to attempt a heal on the object. + if countErrs(errs, errDiskNotFound) > 0 { + return fi, metaArr, onlineDisks, nil + } + var missingBlocks int for i, err := range errs { if err != nil && errors.Is(err, errFileNotFound) { diff --git a/cmd/storage-rest-client.go b/cmd/storage-rest-client.go index e6ff6d641..9700c6e70 100644 --- a/cmd/storage-rest-client.go +++ b/cmd/storage-rest-client.go @@ -238,6 +238,14 @@ func (client *storageRESTClient) SetDiskID(id string) { // DiskInfo - fetch disk information for a remote disk. func (client *storageRESTClient) DiskInfo(ctx context.Context) (info DiskInfo, err error) { + if !client.IsOnline() { + // make sure to check if the disk is offline, since the underlying + // value is cached we should attempt to invalidate it if such calls + // were attempted. This can lead to false success under certain conditions + // - this change attempts to avoid stale information if the underlying + // transport is already down. + return info, errDiskNotFound + } client.diskInfoCache.Once.Do(func() { client.diskInfoCache.TTL = time.Second client.diskInfoCache.Update = func() (interface{}, error) {