Flush metadata collision segment on core remove

If there is any dirty data on the cache associated with removed core,
we must flush collision metadata after removing core to make metadata
persistent in case of dirty shutdown.

This fixes the problem when recovery procedure erroneously interprets
cache lines that belonged to removed core as valid ones.

This also fixes the problem, when after removing core containing dirty
data another core is added, and then recovery procedure following dirty
shutdown assigns cache lines from removed core to the new one, effectively
leading to data corruption.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2021-01-19 13:19:32 +01:00
parent 3f7139a814
commit 5a88ab2d61
3 changed files with 52 additions and 8 deletions

View File

@@ -1024,6 +1024,23 @@ void ocf_metadata_flush_all(ocf_cache_t cache,
ocf_pipeline_next(pipeline);
}
/*
* Flush collision metadata
*/
void ocf_metadata_flush_collision(ocf_cache_t cache,
ocf_metadata_end_t cmpl, void *priv)
{
struct ocf_metadata_ctrl *ctrl;
struct ocf_metadata_raw *raw;
OCF_DEBUG_TRACE(cache);
ctrl = cache->metadata.priv;
raw = &ctrl->raw_desc[metadata_segment_collision];
ocf_metadata_raw_flush_all(cache, raw, cmpl, priv);
}
/*
* Flush specified cache line
*/

View File

@@ -123,6 +123,16 @@ ocf_cache_line_t ocf_metadata_get_pages_count(struct ocf_cache *cache);
void ocf_metadata_flush_all(ocf_cache_t cache,
ocf_metadata_end_t cmpl, void *priv);
/**
* @brief Flush metadata collision segment
*
* @param cache - Cache instance
* @param cmpl - Completion callback
* @param priv - Completion context
*/
void ocf_metadata_flush_collision(ocf_cache_t cache,
ocf_metadata_end_t cmpl, void *priv);
/**
* @brief Mark specified cache line to be flushed
*