diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c index a5cb9f3ce..3d82a05d2 100644 --- a/lib/metadata/merge.c +++ b/lib/metadata/merge.c @@ -328,6 +328,13 @@ static void _check_lv_segment(struct logical_volume *lv, struct lv_segment *seg, if (seg_is_cache_pool(seg)) { if (!dm_list_empty(&seg->lv->segs_using_this_lv)) { + switch (seg->cache_metadata_format) { + case CACHE_METADATA_FORMAT_2: + case CACHE_METADATA_FORMAT_1: + break; + default: + seg_error("has invalid cache metadata format"); + } switch (seg->cache_mode) { case CACHE_MODE_WRITETHROUGH: case CACHE_MODE_WRITEBACK: @@ -341,13 +348,22 @@ static void _check_lv_segment(struct logical_volume *lv, struct lv_segment *seg, } if (!validate_cache_chunk_size(lv->vg->cmd, seg->chunk_size)) seg_error("has invalid chunk size."); + if (seg->lv->status & LV_METADATA_FORMAT) { + if (seg->cache_metadata_format != CACHE_METADATA_FORMAT_2) + seg_error("sets METADATA_FORMAT flag"); + } else if (seg->cache_metadata_format == CACHE_METADATA_FORMAT_2) + seg_error("is missing METADATA_FORMAT flag"); } else { /* !cache_pool */ + if (seg->cache_metadata_format) + seg_error("sets cache metadata format"); if (seg->cache_mode) seg_error("sets cache mode"); if (seg->policy_name) seg_error("sets policy name"); if (seg->policy_settings) seg_error("sets policy settings"); + if (seg->lv->status & LV_METADATA_FORMAT) + seg_error("sets METADATA_FORMAT flag"); } if (!seg_can_error_when_full(seg) && lv_is_error_when_full(lv))