XL: return error if DeleteObject() fails. (#1878)

Previously DeleteObject() does not return any error if write quorum is
not available.  This patch fixes the issue by returning errors.
This commit is contained in:
Bala FA 2016-06-08 00:05:03 +05:30 committed by Harshavardhana
parent d32f3288f8
commit d13e6e7156

View File

@ -438,7 +438,7 @@ func (xl xlObjects) deleteObject(bucket, object string) error {
// DeleteObject - deletes an object, this call doesn't necessary reply
// any error as it is not necessary for the handler to reply back a
// response to the client request.
func (xl xlObjects) DeleteObject(bucket, object string) error {
func (xl xlObjects) DeleteObject(bucket, object string) (err error) {
// Verify if bucket is valid.
if !IsValidBucketName(bucket) {
return BucketNameInvalid{Bucket: bucket}
@ -448,6 +448,11 @@ func (xl xlObjects) DeleteObject(bucket, object string) error {
}
nsMutex.Lock(bucket, object)
defer nsMutex.Unlock(bucket, object)
xl.deleteObject(bucket, object)
return nil
if err = xl.deleteObject(bucket, object); err == errFileNotFound {
// Its valid to return success if given object is not found.
err = nil
}
return err
}