From 36f609e513262547aa4d92c2b55d98b1471ba2e2 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 17 Dec 2016 21:58:35 +0100 Subject: [PATCH] validation: check external property is matching Detect if number of external_count is matching referencing devices for external_origin LV. --- WHATS_NEW | 1 + lib/metadata/merge.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 6d368908a..50023082c 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Extend metadata validation of external origin LV use count. Fix dm table when the last user of active external origin is removed. Improve reported lvs status for active external origin volume. Fix table load for splitted RAID LV and require explicit activation. diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c index 6d52bc452..947513b83 100644 --- a/lib/metadata/merge.c +++ b/lib/metadata/merge.c @@ -398,6 +398,18 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg) inc_error_count; } } + + if (lv_is_external_origin(lv)) { + seg_found = 0; + dm_list_iterate_items(sl, &lv->segs_using_this_lv) + if (sl->seg->external_lv == lv) + seg_found++; + if (seg_found != lv->external_count) { + log_error("LV %s: external origin count does not match.", + lv->name); + inc_error_count; + } + } } dm_list_iterate_items(seg, &lv->segments) { -- 2.43.5