diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index 029295d1..bf39be97 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -826,37 +826,59 @@ static void _ocf_mngt_load_metadata(ocf_pipeline_t pipeline, * @brief allocate memory for new cache, add it to cache queue, set initial * values and running state */ -static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params) +static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params, + char *new_cache_name) { ocf_cache_t cache = env_vzalloc(sizeof(*cache)); int result; - if (!cache) + if (!cache) { + ocf_log(params->ctx, log_err, "Failed to allocate cache %s\n", + new_cache_name); return -OCF_ERR_NO_MEM; + } if (ocf_mngt_cache_lock_init(cache)) { + ocf_log(params->ctx, log_err, + "Failed to allocate cache %s lock\n", + new_cache_name); result = -OCF_ERR_NO_MEM; goto alloc_err; } /* Lock cache during setup - this trylock should always succeed */ result = ocf_mngt_cache_trylock(cache); - if (result) + if (result) { + ocf_log(params->ctx, log_crit, + "Failed to lock the newly created cache %s\n", + new_cache_name); goto lock_init_err; + } if (env_mutex_init(&cache->flush_mutex)) { + ocf_log(params->ctx, log_err, + "Failed to allocate cache %s flush lock\n", + new_cache_name); result = -OCF_ERR_NO_MEM; goto lock_err; } INIT_LIST_HEAD(&cache->io_queues); result = env_spinlock_init(&cache->io_queues_lock); - if (result) + if (result) { + ocf_log(params->ctx, log_err, + "Failed to allocate cache %s queue lock\n", + new_cache_name); goto mutex_err; + } result = !ocf_refcnt_inc(&cache->refcnt.cache); - if (result) + if (result) { + ocf_log(params->ctx, log_crit, + "Failed to increment %s refcnt\n", + new_cache_name); goto cache_refcnt_inc_err; + } /* start with freezed metadata ref counter to indicate detached device*/ ocf_refcnt_freeze(&cache->refcnt.metadata); @@ -957,7 +979,7 @@ static int _ocf_mngt_init_prepare_cache(struct ocf_cache_mngt_init_params *param ocf_log(param->ctx, log_info, "Inserting cache %s\n", cfg->name); - ret = _ocf_mngt_init_new_cache(param); + ret = _ocf_mngt_init_new_cache(param, cfg->name); if (ret) goto out;