Skip to contentSkip to conversation

master - metadata: also validate historical LVs in VG in vg_validate and check_lv_segments

PATCH Peter Rajnoha 1 participant 1 message Mar 3, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1297b0c8bef38a9269186ca26d6827560ce0fddf
Commit:        1297b0c8bef38a9269186ca26d6827560ce0fddf
Parent:        fc628e92ba1b403988a0b058d0d3283d23bab5bf
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Tue Mar 1 15:32:01 2016 +0100
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Thu Mar 3 13:50:59 2016 +0100

metadata: also validate historical LVs in VG in vg_validate and check_lv_segments

---
 lib/metadata/merge.c    |   20 +++++++++++
 lib/metadata/metadata.c |   88 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 0 deletions(-)
lib/metadata/merge.c +20 -0
index a36cafd..17227c1 100644
@@ -80,6 +80,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
 	unsigned seg_count = 0, seg_found;
 	uint32_t area_multiplier, s;
 	struct seg_list *sl;
+	struct glv_list *glvl;
 	int error_count = 0;
 	struct replicator_site *rsite;
 	struct replicator_device *rdev;
@@ -495,6 +496,25 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
 		}
 	}
 
+	dm_list_iterate_items(glvl, &lv->indirect_glvs) {
+		if (glvl->glv->is_historical) {
+			if (glvl->glv->historical->indirect_origin != lv->this_glv) {
+				log_error("LV %s is indirectly used by historical LV %s"
+					  "but that historical LV does not point back to LV %s",
+					   lv->name, glvl->glv->historical->name, lv->name);
+				inc_error_count;
+			}
+		} else {
+			if (!(seg = first_seg(glvl->glv->live)) ||
+			    seg->indirect_origin != lv->this_glv) {
+				log_error("LV %s is indirectly used by LV %s"
+					  "but that LV does not point back to LV %s",
+					  lv->name, glvl->glv->live->name, lv->name);
+				inc_error_count;
+			}
+		}
+	}
+
 	if (le != lv->le_count) {
 		log_error("LV %s: inconsistent LE count %u != %u",
 			  lv->name, le, lv->le_count);
lib/metadata/metadata.c +88 -0

112 lines not on this page · raw message