Add missing ocf_metadata_read_sb error handling

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2022-09-06 13:11:26 +02:00
parent 93b6ddb8a7
commit 0a09d05a8b
2 changed files with 9 additions and 0 deletions

View File

@ -1650,6 +1650,9 @@ static void ocf_metadata_load_properties_cmpl(
ocf_ctx_t ctx = context->ctx;
int result;
if (context->error)
OCF_CMPL_RET(priv, context->error, NULL);
result = ocf_metadata_validate_superblock(ctx, superblock);
if (result)
OCF_CMPL_RET(priv, result, NULL);
@ -1694,6 +1697,9 @@ static void ocf_metadata_probe_cmpl(struct ocf_metadata_read_sb_ctx *context)
ocf_metadata_probe_end_t cmpl = context->priv1;
void *priv = context->priv2;
if (context->error)
OCF_CMPL_RET(priv, context->error, NULL);
if (superblock->magic_number != CACHE_MAGIC_NUMBER)
OCF_CMPL_RET(priv, -OCF_ERR_NO_METADATA, NULL);

View File

@ -2335,6 +2335,9 @@ static void _ocf_mngt_activate_compare_superblock_end(
ocf_cache_t cache = context->cache;
int result, diff;
if (sb_ctx->error)
OCF_PL_FINISH_RET(context->pipeline, sb_ctx->error);
result = env_memcmp(cache->conf_meta, sizeof(*cache->conf_meta),
superblock, sizeof(*superblock), &diff);
if (result)