Skip to contentSkip to conversation

master - md component detection addition in vg_read

PATCH David Teigland 1 participant 1 message Aug 16, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=65bcd16be2cb46c73f6243e553b4a8685c159b7a
Commit:        65bcd16be2cb46c73f6243e553b4a8685c159b7a
Parent:        ad560a286a0b5d08086324e6194b060c136e9353
Author:        David Teigland <[email protected]>
AuthorDate:    Thu Aug 1 14:43:19 2019 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Fri Aug 16 13:24:34 2019 -0500

md component detection addition in vg_read

Usually md components are eliminated in label scan and/or duplicate resolution, but they could sometimes get into the vg_read stage, where set_pv_devices compares the device to the PV.

If set_pv_devices runs an md component check and finds one, vg_read should eliminate the components.

In set_pv_devices, run an md component check always if the PV is smaller than the device (this is not very common.) If the PV is larger than the device, (more common), do the component check when the config setting is "auto" (the default).

---
 lib/format_text/archiver.c |    2 +-
 lib/format_text/import.c   |    2 +-
 lib/metadata/metadata.c    |   80 ++++++++++++++++++++++++++++++++++++--------
 lib/metadata/metadata.h    |    2 +-
 tools/pvscan.c             |    2 +-
 5 files changed, 70 insertions(+), 18 deletions(-)
lib/format_text/archiver.c +1 -1
index 052c2bd..3a741da 100644
@@ -321,7 +321,7 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd,
 	}
 
 	if (vg)
-		set_pv_devices(tf, vg);
+		set_pv_devices(tf, vg, NULL);
 
 	if (!vg)
 		tf->fmt->ops->destroy_instance(tf);
lib/format_text/import.c +1 -1
index 743077b..79276dd 100644
@@ -230,7 +230,7 @@ static struct volume_group *_import_vg_from_config_tree(const struct dm_config_t
 		if (!(vg = (*vsn)->read_vg(fid, cft, allow_lvmetad_extensions)))
 			stack;
 		else {
-			set_pv_devices(fid, vg);
+			set_pv_devices(fid, vg, NULL);
 
 			if ((vg_missing = vg_missing_pv_count(vg)))
 				log_verbose("There are %d physical volumes missing.", vg_missing);
lib/metadata/metadata.c +66 -14

131 lines not on this page · raw message

lib/metadata/metadata.h +1 -1
index 2fc0015..6516e62 100644
@@ -517,6 +517,6 @@ struct id pv_vgid(const struct physical_volume *pv);
 uint64_t find_min_mda_size(struct dm_list *mdas);
 char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl);
 
-void set_pv_devices(struct format_instance *fid, struct volume_group *vg);
+void set_pv_devices(struct format_instance *fid, struct volume_group *vg, int *found_md_component);
 
 #endif
tools/pvscan.c +1 -1
index 2a88eaa..168d509 100644
@@ -618,7 +618,7 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
 			*pvid_without_metadata = dm_pool_strdup(cmd->mem, dev->pvid);
 		fmt->ops->destroy_instance(baton.fid);
 	} else {
-		set_pv_devices(baton.fid, baton.vg);
+		set_pv_devices(baton.fid, baton.vg, NULL);
 	}
 
 	/* This check repeated because set_pv_devices can do new md check. */