do not try to delete non-existent object in cache (#7560)

handle cache cleanup correctly when backend object was deleted.

Fixes: #7558
master
poornas 6 years ago committed by kannappanr
parent 816459d10f
commit 2c096c569f
  1. 9
      cmd/disk-cache.go

@ -200,9 +200,12 @@ func (c cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string,
return cacheReader, nil
} else if err != nil {
if _, ok := err.(ObjectNotFound); ok {
cacheReader.Close()
// Delete cached entry if backend object was deleted.
dcache.Delete(ctx, bucket, object)
if cacheErr == nil {
cacheReader.Close()
// Delete cached entry if backend object
// was deleted.
dcache.Delete(ctx, bucket, object)
}
}
return nil, err
}

Loading…
Cancel
Save