Moved setting ctx for temporary cache object before metadata init

This way debug prints during metadata init phase won't cause crash
(because of the fact that temporary cache object does not have proper
ctx set hence does not have logger obj).

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski 2020-01-16 21:53:17 +01:00
parent ce28c71475
commit 65756a8160

View File

@ -1206,6 +1206,7 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache,
} }
tmp_cache = params.cache; tmp_cache = params.cache;
tmp_cache->owner = ctx;
/* /*
* Initialize metadata selected segments of metadata in memory * Initialize metadata selected segments of metadata in memory
@ -1218,8 +1219,6 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache,
} }
params.flags.metadata_inited = true; params.flags.metadata_inited = true;
tmp_cache->owner = ctx;
result = ocf_cache_set_name(tmp_cache, cfg->name, OCF_CACHE_NAME_SIZE); result = ocf_cache_set_name(tmp_cache, cfg->name, OCF_CACHE_NAME_SIZE);
if (result) { if (result) {
env_rmutex_unlock(&ctx->lock); env_rmutex_unlock(&ctx->lock);