Changed err handling to BUG_ON in case of refcnt_int fail durign cache init.

Since we do not expect that incrementing cache's reference counter
during cache init will fail at any condition it is can be changed
to an assert instead of error handling.

Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
Michal Rakowski 2019-09-27 11:49:54 +02:00
parent 9504cb044d
commit 8426d662cb

View File

@ -568,10 +568,7 @@ static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params)
goto lock_err; goto lock_err;
} }
if (!ocf_refcnt_inc(&cache->refcnt.cache)){ ENV_BUG_ON(!ocf_refcnt_inc(&cache->refcnt.cache));
result = -OCF_ERR_START_CACHE_FAIL;
goto flush_mutex_err;
}
/* start with freezed metadata ref counter to indicate detached device*/ /* start with freezed metadata ref counter to indicate detached device*/
ocf_refcnt_freeze(&cache->refcnt.metadata); ocf_refcnt_freeze(&cache->refcnt.metadata);
@ -586,8 +583,6 @@ static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params)
return 0; return 0;
flush_mutex_err:
env_mutex_destroy(&cache->flush_mutex);
lock_err: lock_err:
ocf_mngt_cache_lock_deinit(cache); ocf_mngt_cache_lock_deinit(cache);
alloc_err: alloc_err: