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 return cacheReader, nil
} else if err != nil { } else if err != nil {
if _, ok := err.(ObjectNotFound); ok { if _, ok := err.(ObjectNotFound); ok {
cacheReader.Close() if cacheErr == nil {
// Delete cached entry if backend object was deleted. cacheReader.Close()
dcache.Delete(ctx, bucket, object) // Delete cached entry if backend object
// was deleted.
dcache.Delete(ctx, bucket, object)
}
} }
return nil, err return nil, err
} }

Loading…
Cancel
Save