From 11dacd6a84138f9a9497a29ba26b19bc8f5b5c86 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Tue, 16 Nov 2021 14:35:36 +0100 Subject: [PATCH] Set dirty shutdown status on standby init Since part of the recovery is done during `standby init`, the correct shutdown status has to be set Signed-off-by: Michal Mielewczyk --- src/mngt/ocf_mngt_cache.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index cfd410a..5b858ff 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -1997,6 +1997,22 @@ static void _ocf_mngt_load_unsafe_complete(void *priv, int error) ocf_pipeline_next(context->pipeline); } +static void _ocf_mngt_standby_init_properties(ocf_pipeline_t pipeline, + void *priv, ocf_pipeline_arg_t arg) +{ + struct ocf_cache_attach_context *context = priv; + ocf_cache_t cache = context->cache; + + OCF_ASSERT_PLUGGED(cache); + + context->metadata.shutdown_status = ocf_metadata_dirty_shutdown; + context->metadata.dirty_flushed = DIRTY_FLUSHED; + context->metadata.line_size = context->cfg.cache_line_size ?: + cache->metadata.line_size; + + ocf_pipeline_next(pipeline); +} + static void _ocf_mngt_load_metadata_unsafe(ocf_pipeline_t pipeline, void *priv, ocf_pipeline_arg_t arg) { @@ -2038,7 +2054,7 @@ struct ocf_pipeline_properties _ocf_mngt_cache_standby_pipeline_properties = { OCF_PL_STEP(_ocf_mngt_init_attached_nonpersistent), OCF_PL_STEP(_ocf_mngt_attach_cache_device), OCF_PL_STEP(_ocf_mngt_init_cache_front_volume), - OCF_PL_STEP(_ocf_mngt_init_properties), + OCF_PL_STEP(_ocf_mngt_standby_init_properties), OCF_PL_STEP(_ocf_mngt_attach_check_ram), OCF_PL_STEP(_ocf_mngt_test_volume), OCF_PL_STEP(_ocf_mngt_attach_prepare_metadata),