Decrement cache.refcnt if locking cache failed

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Michal Mielewczyk 2024-10-04 15:41:23 +02:00
parent 6ad1007e6f
commit fae30462b1

View File

@ -270,8 +270,10 @@ static int _ocf_mngt_cache_trylock(ocf_cache_t cache,
return -OCF_ERR_CACHE_NOT_EXIST; return -OCF_ERR_CACHE_NOT_EXIST;
result = trylock_fn(&cache->lock); result = trylock_fn(&cache->lock);
if (result) if (result) {
ocf_mngt_cache_put(cache);
return result; return result;
}
if (env_bit_test(ocf_cache_state_stopping, &cache->cache_state)) { if (env_bit_test(ocf_cache_state_stopping, &cache->cache_state)) {
/* Cache already stopping, do not allow any operation */ /* Cache already stopping, do not allow any operation */