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

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