From 340ca761598b1766ba4d2a49399a3bd98dfd199f Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Thu, 1 Aug 2019 03:42:20 -0400 Subject: [PATCH] Move check for valid cache size in load. Loaded cache size should be compared with acutal cache size after loading superblock. Signed-off-by: Michal Mielewczyk --- src/mngt/ocf_mngt_cache.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index d923c74..9a97f22 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -377,13 +377,6 @@ static int _ocf_mngt_init_instance_add_cores( OCF_ASSERT_PLUGGED(cache); - if (cache->conf_meta->cachelines != - ocf_metadata_get_cachelines_count(cache)) { - ocf_cache_log(cache, log_err, - "ERROR: Cache device size mismatch!\n"); - return -OCF_ERR_START_CACHE_FAIL; - } - /* Count value will be re-calculated on the basis of 'added' flag */ cache->conf_meta->core_count = 0; @@ -1303,6 +1296,14 @@ static void _ocf_mngt_attach_load_superblock_complete(void *priv, int error) struct ocf_cache_attach_context *context = priv; ocf_cache_t cache = context->cache; + if (cache->conf_meta->cachelines != + ocf_metadata_get_cachelines_count(cache)) { + ocf_cache_log(cache, log_err, + "ERROR: Cache device size mismatch!\n"); + OCF_PL_FINISH_RET(context->pipeline, + -OCF_ERR_START_CACHE_FAIL); + } + if (error) { ocf_cache_log(cache, log_err, "ERROR: Cannot load cache state\n");