diff --git a/pkg/local_object_storage/blobstor/blobovnicza.go b/pkg/local_object_storage/blobstor/blobovnicza.go index 3adf42e72d..3a6bbffa9b 100644 --- a/pkg/local_object_storage/blobstor/blobovnicza.go +++ b/pkg/local_object_storage/blobstor/blobovnicza.go @@ -807,11 +807,19 @@ func (b *blobovniczas) close() error { // // If blobovnicza is already opened and cached, instance from cache is returned w/o changes. func (b *blobovniczas) openBlobovnicza(p string) (*blobovnicza.Blobovnicza, error) { + b.lruMtx.Lock() + v, ok := b.opened.Get(p) + b.lruMtx.Unlock() + if ok { + // blobovnicza should be opened in cache + return v.(*blobovnicza.Blobovnicza), nil + } + b.openMtx.Lock() defer b.openMtx.Unlock() b.lruMtx.Lock() - v, ok := b.opened.Get(p) + v, ok = b.opened.Get(p) b.lruMtx.Unlock() if ok { // blobovnicza should be opened in cache