Check for load error before accessing metadata content

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2022-03-28 22:08:05 +02:00
parent 174f7b5c2b
commit 84aa968877

View File

@ -1544,6 +1544,13 @@ static void _ocf_mngt_load_superblock_complete(void *priv, int error)
ocf_cache_t cache = context->cache; ocf_cache_t cache = context->cache;
ocf_cleaning_t loaded_clean_policy = cache->conf_meta->cleaning_policy_type; ocf_cleaning_t loaded_clean_policy = cache->conf_meta->cleaning_policy_type;
if (error) {
ocf_cache_log(cache, log_err,
"ERROR: Cannot load cache state\n");
OCF_PL_FINISH_RET(context->pipeline,
-OCF_ERR_START_CACHE_FAIL);
}
if (cache->conf_meta->cachelines != if (cache->conf_meta->cachelines !=
ocf_metadata_get_cachelines_count(cache)) { ocf_metadata_get_cachelines_count(cache)) {
ocf_cache_log(cache, log_err, ocf_cache_log(cache, log_err,
@ -1561,13 +1568,6 @@ static void _ocf_mngt_load_superblock_complete(void *priv, int error)
__set_cleaning_policy(cache, loaded_clean_policy); __set_cleaning_policy(cache, loaded_clean_policy);
if (error) {
ocf_cache_log(cache, log_err,
"ERROR: Cannot load cache state\n");
OCF_PL_FINISH_RET(context->pipeline,
-OCF_ERR_START_CACHE_FAIL);
}
ocf_pipeline_next(context->pipeline); ocf_pipeline_next(context->pipeline);
} }