XL: return false only if given prefix doesn't exist in all disks (#1877)

Previously xl.isObject() returns false if one of the disk doesn't have
the object.  Its possible that object may be present in another disk.

This patch fixes the issue by returning false only if given prefix
doesn't exist in all disks.

Fixes #1855
This commit is contained in:
Bala FA 2016-06-07 23:32:12 +05:30 committed by Harshavardhana
parent c5b6cb2420
commit d32f3288f8

View File

@ -61,16 +61,19 @@ func (xl xlObjects) isObject(bucket, prefix string) bool {
if disk == nil {
continue
}
// Check if 'prefix' is an object in this 'disk', else continue the check with next disk
_, err := disk.StatFile(bucket, path.Join(prefix, xlMetaJSONFile))
if err != nil {
if err == errDiskNotFound {
if err == errFileNotFound || err == errDiskNotFound {
continue
}
return false
// TODO: log the error
} else {
return true
}
break
}
return true
return false
}
// statPart - returns fileInfo structure for a successful stat on part file.