Deinit cleaning policy if attaching cache failed
Normally cleaning policy would be deinitialized during stopping cache which is one of steps of error handling e.g in case of failed cache activation. But since `cache_stop()` may be called only for an attached cache instance, cleaning policy needs to deinitialized explicitly. Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
21d5da83d9
commit
ca70ea3fff
@ -130,6 +130,9 @@ struct ocf_cache_attach_context {
|
|||||||
bool promotion_initialized : 1;
|
bool promotion_initialized : 1;
|
||||||
/*!< Promotion policy has been started */
|
/*!< Promotion policy has been started */
|
||||||
|
|
||||||
|
bool cleaning_initialized : 1;
|
||||||
|
/*!< Cleaning policy has been initialized */
|
||||||
|
|
||||||
bool cores_opened : 1;
|
bool cores_opened : 1;
|
||||||
/*!< underlying cores are opened (happens only during
|
/*!< underlying cores are opened (happens only during
|
||||||
* load or recovery
|
* load or recovery
|
||||||
@ -1233,6 +1236,7 @@ static void _ocf_mngt_attach_init_services(ocf_pipeline_t pipeline,
|
|||||||
considered to be flushed
|
considered to be flushed
|
||||||
*/
|
*/
|
||||||
cache->conf_meta->dirty_flushed = true;
|
cache->conf_meta->dirty_flushed = true;
|
||||||
|
context->flags.cleaning_initialized = true;
|
||||||
|
|
||||||
ocf_pipeline_next(pipeline);
|
ocf_pipeline_next(pipeline);
|
||||||
}
|
}
|
||||||
@ -1728,6 +1732,9 @@ static void _ocf_mngt_attach_handle_error(
|
|||||||
if (context->flags.promotion_initialized)
|
if (context->flags.promotion_initialized)
|
||||||
__deinit_promotion_policy(cache);
|
__deinit_promotion_policy(cache);
|
||||||
|
|
||||||
|
if (context->flags.cleaning_initialized)
|
||||||
|
__deinit_cleaning_policy(cache);
|
||||||
|
|
||||||
if (context->flags.cores_opened)
|
if (context->flags.cores_opened)
|
||||||
_ocf_mngt_deinit_added_cores(context);
|
_ocf_mngt_deinit_added_cores(context);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user