mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_02_183-pvscan-lvmetad-use-full-md-filter-when-md-1.0-device.patch

3a5d46
 tools/pvscan.c | 19 +++++++++++++++++++
3a5d46
 1 file changed, 19 insertions(+)
3a5d46
3a5d46
diff --git a/tools/pvscan.c b/tools/pvscan.c
3a5d46
index d9ad097..47ad0f1 100644
3a5d46
--- a/tools/pvscan.c
3a5d46
+++ b/tools/pvscan.c
3a5d46
@@ -18,6 +18,8 @@
3a5d46
 #include "lvmetad.h"
3a5d46
 #include "lvmcache.h"
3a5d46
 
3a5d46
+extern int use_full_md_check;
3a5d46
+
3a5d46
 struct pvscan_params {
3a5d46
 	int new_pvs_found;
3a5d46
 	int pvs_found;
3a5d46
@@ -302,6 +304,7 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
3a5d46
 	struct dm_list found_vgnames;
3a5d46
 	struct device *dev;
3a5d46
 	struct device_list *devl;
3a5d46
+	struct dev_iter *iter;
3a5d46
 	const char *pv_name;
3a5d46
 	const char *reason = NULL;
3a5d46
 	int32_t major = -1;
3a5d46
@@ -443,6 +446,22 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)
3a5d46
 	/* Creates a list of dev names from /dev, sysfs, etc; does not read any. */
3a5d46
 	dev_cache_scan();
3a5d46
 
3a5d46
+	/* See the same check in label_scan() to handle md 0.9/1.0 components. */
3a5d46
+	if (!(iter = dev_iter_create(cmd->full_filter, 0))) {
3a5d46
+		log_error("Scanning failed to get devices.");
3a5d46
+		return 0;
3a5d46
+	}
3a5d46
+	while ((dev = dev_iter_get(iter))) {
3a5d46
+		if (dev_is_md_with_end_superblock(cmd->dev_types, dev)) {
3a5d46
+			cmd->use_full_md_check = 1;
3a5d46
+			use_full_md_check = 1;
3a5d46
+			log_debug("Found md with end superblock %s", dev_name(dev));
3a5d46
+		}
3a5d46
+	}
3a5d46
+	dev_iter_destroy(iter);
3a5d46
+	if (!use_full_md_check)
3a5d46
+		log_debug("No md devs with end superblock");
3a5d46
+
3a5d46
 	dm_list_init(&single_devs);
3a5d46
 
3a5d46
 	while (argc--) {