Merge pull request #206 from Open-CAS/fix-leaking-core-volumes

Fix leaking front and core volumes
This commit is contained in:
Adam Rutkowski 2019-06-26 04:45:07 -04:00 committed by GitHub
commit 252cb2dd8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -22,7 +22,11 @@ int cache_mngt_core_close(ocf_core_t core)
if (!core->opened) if (!core->opened)
return -OCF_ERR_CORE_IN_INACTIVE_STATE; return -OCF_ERR_CORE_IN_INACTIVE_STATE;
ocf_volume_close(&core->front_volume);
ocf_volume_deinit(&core->front_volume);
ocf_volume_close(&core->volume); ocf_volume_close(&core->volume);
ocf_volume_deinit(&core->volume);
core->opened = false; core->opened = false;
return 0; return 0;

View File

@ -456,7 +456,11 @@ int ocf_mngt_core_init_front_volume(ocf_core_t core)
if (ret) if (ret)
return ret; return ret;
return ocf_volume_open(&core->front_volume, NULL); ret = ocf_volume_open(&core->front_volume, NULL);
if (ret)
ocf_volume_deinit(&core->front_volume);
return ret;
} }
static void ocf_mngt_cache_add_core_prepare(ocf_pipeline_t pipeline, static void ocf_mngt_cache_add_core_prepare(ocf_pipeline_t pipeline,
@ -659,8 +663,6 @@ static void _ocf_mngt_cache_remove_core(ocf_pipeline_t pipeline, void *priv,
ocf_core_log(core, log_debug, "Removing core\n"); ocf_core_log(core, log_debug, "Removing core\n");
ocf_volume_close(&core->front_volume);
/* Deinit everything*/ /* Deinit everything*/
if (ocf_cache_is_device_attached(cache)) { if (ocf_cache_is_device_attached(cache)) {
cache_mngt_core_deinit_attached_meta(core); cache_mngt_core_deinit_attached_meta(core);