Return more specific error on CRC mismatch

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2022-03-28 22:42:59 +02:00
parent 84aa968877
commit af43a240d3
4 changed files with 6 additions and 3 deletions

View File

@ -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,

View File

@ -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);

View File

@ -1547,8 +1547,7 @@ static void _ocf_mngt_load_superblock_complete(void *priv, int error)
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_PL_FINISH_RET(context->pipeline, error);
}
if (cache->conf_meta->cachelines !=

View File

@ -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()