0469456
 tools/pvscan.c | 40 ++++++++++------------------------------
0469456
 1 file changed, 10 insertions(+), 30 deletions(-)
0469456
0469456
diff --git a/tools/pvscan.c b/tools/pvscan.c
0469456
index d41345f..db813ad 100644
0469456
--- a/tools/pvscan.c
0469456
+++ b/tools/pvscan.c
0469456
@@ -621,6 +621,16 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
0469456
 		set_pv_devices(baton.fid, baton.vg);
0469456
 	}
0469456
 
0469456
+	/* This check repeated because set_pv_devices can do new md check. */
0469456
+	if (dev->flags & DEV_IS_MD_COMPONENT) {
0469456
+		log_print("pvscan[%d] PV %s ignore MD component, ignore metadata.", getpid(), dev_name(dev));
0469456
+		if (baton.vg)
0469456
+			release_vg(baton.vg);
0469456
+		else
0469456
+			fmt->ops->destroy_instance(baton.fid);
0469456
+		return 1;
0469456
+	}
0469456
+
0469456
 	if (baton.vg && vg_is_shared(baton.vg)) {
0469456
 		log_print("pvscan[%d] PV %s ignore shared VG.", getpid(), dev_name(dev));
0469456
 		release_vg(baton.vg);
0469456
@@ -638,36 +648,6 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
0469456
 		return 1;
0469456
 	}
0469456
 
0469456
-	/*
0469456
-	 * Do not consider a device online (for purposes of autoactivation)
0469456
-	 * if its size does not match the PV size recorded in the metadata.
0469456
-	 * It may mean that it's not the correct dev for the PV, e.g. it
0469456
-	 * could be an md component device that's not been filtered.
0469456
-	 */
0469456
-	if (baton.vg && cmd->check_pv_dev_sizes) {
0469456
-		struct pv_list *pvl;
0469456
-		uint64_t dev_size = 0;
0469456
-		uint64_t meta_pv_size = 0;
0469456
-
0469456
-		dm_list_iterate_items(pvl, &baton.vg->pvs) {
0469456
-			if (pvl->pv->dev != dev)
0469456
-				continue;
0469456
-
0469456
-			if (!dev_get_size(dev, &dev_size))
0469456
-				stack;
0469456
-			meta_pv_size = pv_size(pvl->pv);
0469456
-			break;
0469456
-		}
0469456
-
0469456
-		if (dev_size != meta_pv_size) {
0469456
-			log_print("pvscan[%d] PV %s ignore for size %llu not matching device %llu.",
0469456
-				  getpid(), dev_name(dev),
0469456
-				  (unsigned long long)meta_pv_size, (unsigned long long)dev_size);
0469456
-			release_vg(baton.vg);
0469456
-			return 1;
0469456
-		}
0469456
-	}
0469456
-
0469456
 	ret = _online_pv_found(cmd, dev, dev_args, baton.vg, found_vgnames);
0469456
 
0469456
 	/*