mirror of https://github.com/minio/minio.git
xl: Fix isObject() to consider not found disks (#8411)
xl.isObject() returns 'nil' for not found disks when calculating the existance of xl.json for a given object, which what StatFile() is also doing (setting nil) if xl.json exists. This commit avoids this confusion by setting errDiskNotFound error when the storage disk is not found.
This commit is contained in:
parent
140a7eadb4
commit
7bf093c06a
|
@ -58,12 +58,13 @@ func (xl xlObjects) isObject(bucket, prefix string) (ok bool) {
|
||||||
|
|
||||||
g := errgroup.WithNErrs(len(storageDisks))
|
g := errgroup.WithNErrs(len(storageDisks))
|
||||||
|
|
||||||
for index, disk := range storageDisks {
|
for i := range storageDisks {
|
||||||
if disk == nil {
|
// Initialize a new index variable before passing to the goroutine
|
||||||
continue
|
index := i
|
||||||
}
|
|
||||||
index := index
|
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
|
if storageDisks[index] == nil {
|
||||||
|
return errDiskNotFound
|
||||||
|
}
|
||||||
// Check if 'prefix' is an object on this 'disk', else continue the check the next disk
|
// Check if 'prefix' is an object on this 'disk', else continue the check the next disk
|
||||||
fi, err := storageDisks[index].StatFile(bucket, pathJoin(prefix, xlMetaJSONFile))
|
fi, err := storageDisks[index].StatFile(bucket, pathJoin(prefix, xlMetaJSONFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -73,7 +74,7 @@ func (xl xlObjects) isObject(bucket, prefix string) (ok bool) {
|
||||||
return errCorruptedFormat
|
return errCorruptedFormat
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}, index)
|
}, i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Observe we are not trying to read `xl.json` and figure out the actual
|
// NOTE: Observe we are not trying to read `xl.json` and figure out the actual
|
||||||
|
|
Loading…
Reference in New Issue