Fix cache reference management in get/set seq cutoff threshold

ocf_core_get_cache does not increment cache reference count, so
it shouldn't be paired with cache_put

Fixes #117

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2019-09-26 14:06:46 -04:00
parent 4efd9f1858
commit 186bfbc704

View File

@ -1632,15 +1632,12 @@ int cache_mngt_get_seq_cutoff_threshold(ocf_core_t core, uint32_t *thresh)
int result; int result;
result = _cache_mngt_read_lock_sync(cache); result = _cache_mngt_read_lock_sync(cache);
if (result) { if (result)
ocf_mngt_cache_put(cache);
return result; return result;
}
result = ocf_mngt_core_get_seq_cutoff_threshold(core, thresh); result = ocf_mngt_core_get_seq_cutoff_threshold(core, thresh);
ocf_mngt_cache_read_unlock(cache); ocf_mngt_cache_read_unlock(cache);
ocf_mngt_cache_put(cache);
return result; return result;
} }
@ -1659,15 +1656,12 @@ int cache_mngt_get_seq_cutoff_policy(ocf_core_t core,
int result; int result;
result = _cache_mngt_read_lock_sync(cache); result = _cache_mngt_read_lock_sync(cache);
if (result) { if (result)
ocf_mngt_cache_put(cache);
return result; return result;
}
result = ocf_mngt_core_get_seq_cutoff_policy(core, policy); result = ocf_mngt_core_get_seq_cutoff_policy(core, policy);
ocf_mngt_cache_read_unlock(cache); ocf_mngt_cache_read_unlock(cache);
ocf_mngt_cache_put(cache);
return result; return result;
} }