Skip to contentSkip to conversation

master - tests: add case for metadata checksum differences

PATCH David Teigland 1 participant 1 message Sep 28, 2020

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fb96e9ab217641ec3a967d9aa2be01fc936ee038
Commit:        fb96e9ab217641ec3a967d9aa2be01fc936ee038
Parent:        df6f16c081ffca48f2c812e539851995b7563b68
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Sep 28 13:21:44 2020 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Sep 28 13:25:57 2020 -0500

tests: add case for metadata checksum differences

Cover the case where two copies of metadata have the same seqno but different checksums. Also elaborate on an existing fixme in the code for this case, since we should be doing something better for this case.

This had been uncovering an issue with reopening fds in readwrite mode.

---
 lib/cache/lvmcache.c       |  3 +++
 test/shell/metadata-old.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
 test/shell/pvck-repair.sh  |  2 --
 3 files changed, 48 insertions(+), 2 deletions(-)
lib/cache/lvmcache.c +3 -0
index d8df4c796..9716eccaf 100644
@@ -1663,6 +1663,9 @@ int lvmcache_update_vgname_and_id(struct cmd_context *cmd, struct lvmcache_info
 		 * second updated to seqno 4, first comes back and second goes
 		 * missing, first updated to seqno 4, second comes back, now
 		 * both are present with same seqno but different checksums.
+		 * FIXME: we should check if the majority of mda copies have one
+		 * checksum and if so use that copy of metadata, but if there's
+		 * not a majority, don't allow the VG to be modified/activated.
 		 */
 
 		if ((vginfo->mda_size != vgsummary->mda_size) || (vginfo->mda_checksum != vgsummary->mda_checksum)) {
test/shell/metadata-old.sh +45 -0

48 lines not on this page · raw message

test/shell/pvck-repair.sh +0 -2
index b6038944a..d48e25198 100644
@@ -399,8 +399,6 @@ lvcreate -l1 -an $vg
 # One PV, one mda, pv_header zeroed, unmatching dev name requires specified uuid
 _clear_devs "$dev1" "$dev2"
 vgcreate $vg "$dev1"
-#!!! FIXME: with this hits INTERNAL_ERROR
-#!!! vgcreate $vg "$dev1" "$dev2"
 pvck --dump headers "$dev1" || true
 UUID1=`pvck --dump headers "$dev1" | grep pv_header.pv_uuid | awk '{print $2}'`
 echo $UUID1