Merge pull request #683 from robertbaldyga/better-error-on-crc-mismatch
Return more specific error on CRC mismatch
This commit is contained in:
commit
03df6d3eee
@ -47,6 +47,9 @@ typedef enum {
|
||||
/** Metadata on the device doesn't match with metadata in DRAM */
|
||||
OCF_ERR_SUPERBLOCK_MISMATCH,
|
||||
|
||||
/** Metadata checksum is not correct. Metadata is damaged */
|
||||
OCF_ERR_CRC_MISMATCH,
|
||||
|
||||
/** Invalid volume type */
|
||||
OCF_ERR_INVAL_VOLUME_TYPE,
|
||||
|
||||
|
@ -88,7 +88,7 @@ void ocf_metadata_check_crc(ocf_pipeline_t pipeline,
|
||||
ocf_cache_log(cache, log_err,
|
||||
"Loading %s ERROR, invalid checksum\n",
|
||||
ocf_metadata_segment_names[segment_id]);
|
||||
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_INVAL);
|
||||
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_CRC_MISMATCH);
|
||||
}
|
||||
|
||||
ocf_pipeline_next(pipeline);
|
||||
|
@ -1544,6 +1544,12 @@ static void _ocf_mngt_load_superblock_complete(void *priv, int error)
|
||||
ocf_cache_t cache = context->cache;
|
||||
ocf_cleaning_t loaded_clean_policy = cache->conf_meta->cleaning_policy_type;
|
||||
|
||||
if (error) {
|
||||
ocf_cache_log(cache, log_err,
|
||||
"ERROR: Cannot load cache state\n");
|
||||
OCF_PL_FINISH_RET(context->pipeline, error);
|
||||
}
|
||||
|
||||
if (cache->conf_meta->cachelines !=
|
||||
ocf_metadata_get_cachelines_count(cache)) {
|
||||
ocf_cache_log(cache, log_err,
|
||||
@ -1561,13 +1567,6 @@ static void _ocf_mngt_load_superblock_complete(void *priv, int error)
|
||||
|
||||
__set_cleaning_policy(cache, loaded_clean_policy);
|
||||
|
||||
if (error) {
|
||||
ocf_cache_log(cache, log_err,
|
||||
"ERROR: Cannot load cache state\n");
|
||||
OCF_PL_FINISH_RET(context->pipeline,
|
||||
-OCF_ERR_START_CACHE_FAIL);
|
||||
}
|
||||
|
||||
ocf_pipeline_next(context->pipeline);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ class OcfErrorCode(IntEnum):
|
||||
OCF_ERR_NO_METADATA = auto()
|
||||
OCF_ERR_METADATA_FOUND = auto()
|
||||
OCF_ERR_SUPERBLOCK_MISMATCH = auto()
|
||||
OCF_ERR_CRC_MISMATCH = auto()
|
||||
OCF_ERR_INVAL_VOLUME_TYPE = auto()
|
||||
OCF_ERR_UNKNOWN = auto()
|
||||
OCF_ERR_TOO_MANY_CACHES = auto()
|
||||
|
Loading…
Reference in New Issue
Block a user