Check if loaded cache name is valid.
When loading cache, it's name should be the same as the loaded one. Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
@@ -892,7 +892,6 @@ err_buffer:
|
||||
/**
|
||||
* Prepare metadata accordingly to mode (for load/recovery read from disk)
|
||||
*/
|
||||
|
||||
static void _ocf_mngt_attach_load_properties_end(void *priv, int error,
|
||||
struct ocf_metadata_load_properties *properties)
|
||||
{
|
||||
@@ -919,6 +918,14 @@ static void _ocf_mngt_attach_load_properties_end(void *priv, int error,
|
||||
OCF_PL_FINISH_RET(context->pipeline, -OCF_ERR_METADATA_FOUND);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if name loaded from disk is the same as present one.
|
||||
*/
|
||||
if (env_strncmp(cache->conf_meta->name, properties->cache_name,
|
||||
OCF_CACHE_NAME_SIZE)) {
|
||||
OCF_PL_FINISH_RET(context->pipeline, -OCF_ERR_CACHE_NAME_MISMATCH);
|
||||
}
|
||||
|
||||
context->metadata.shutdown_status = properties->shutdown_status;
|
||||
context->metadata.dirty_flushed = properties->dirty_flushed;
|
||||
|
||||
|
Reference in New Issue
Block a user