a85c03bfb8
- Fix LV activation issues (boo#1152378, rh#1727270) + bug-1152378-md-component-detection-for-differing-PV-and-device-s.patch + bug-1152378-pvscan-fix-PV-online-when-device-has-a-different-siz.patch OBS-URL: https://build.opensuse.org/request/show/734667 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=254
80 lines
2.5 KiB
Diff
80 lines
2.5 KiB
Diff
From b16abb3816408a296343a75658d4be0ef688390b Mon Sep 17 00:00:00 2001
|
|
From: David Teigland <teigland@redhat.com>
|
|
Date: Tue, 9 Jul 2019 13:45:09 -0500
|
|
Subject: [PATCH] pvscan: fix PV online when device has a different size
|
|
|
|
Fix commit 7836e7aa1c17216ed368fda89cfc805a07efda81
|
|
"pvscan: ignore device with incorrect size"
|
|
|
|
which caused pvscan to not consider a PV online (for purposes
|
|
of event based activation) if the PV and device sizes differed.
|
|
|
|
This helped to avoid mistaking MD components for PVs, and is
|
|
replaced by triggering an md component check when PV and device
|
|
sizes differ (which happens in set_pv_device).
|
|
---
|
|
tools/pvscan.c | 40 ++++++++++------------------------------
|
|
1 file changed, 10 insertions(+), 30 deletions(-)
|
|
|
|
diff --git a/tools/pvscan.c b/tools/pvscan.c
|
|
index 12711cb..facc70c 100644
|
|
--- a/tools/pvscan.c
|
|
+++ b/tools/pvscan.c
|
|
@@ -621,6 +621,16 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
|
|
set_pv_devices(baton.fid, baton.vg);
|
|
}
|
|
|
|
+ /* This check repeated because set_pv_devices can do new md check. */
|
|
+ if (dev->flags & DEV_IS_MD_COMPONENT) {
|
|
+ log_print("pvscan[%d] PV %s ignore MD component, ignore metadata.", getpid(), dev_name(dev));
|
|
+ if (baton.vg)
|
|
+ release_vg(baton.vg);
|
|
+ else
|
|
+ fmt->ops->destroy_instance(baton.fid);
|
|
+ return 1;
|
|
+ }
|
|
+
|
|
if (baton.vg && vg_is_shared(baton.vg)) {
|
|
log_print("pvscan[%d] PV %s ignore shared VG.", getpid(), dev_name(dev));
|
|
release_vg(baton.vg);
|
|
@@ -638,36 +648,6 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
|
|
return 1;
|
|
}
|
|
|
|
- /*
|
|
- * Do not consider a device online (for purposes of autoactivation)
|
|
- * if its size does not match the PV size recorded in the metadata.
|
|
- * It may mean that it's not the correct dev for the PV, e.g. it
|
|
- * could be an md component device that's not been filtered.
|
|
- */
|
|
- if (baton.vg && cmd->check_pv_dev_sizes) {
|
|
- struct pv_list *pvl;
|
|
- uint64_t dev_size = 0;
|
|
- uint64_t meta_pv_size = 0;
|
|
-
|
|
- dm_list_iterate_items(pvl, &baton.vg->pvs) {
|
|
- if (pvl->pv->dev != dev)
|
|
- continue;
|
|
-
|
|
- if (!dev_get_size(dev, &dev_size))
|
|
- stack;
|
|
- meta_pv_size = pv_size(pvl->pv);
|
|
- break;
|
|
- }
|
|
-
|
|
- if (dev_size != meta_pv_size) {
|
|
- log_print("pvscan[%d] PV %s ignore for size %llu not matching device %llu.",
|
|
- getpid(), dev_name(dev),
|
|
- (unsigned long long)meta_pv_size, (unsigned long long)dev_size);
|
|
- release_vg(baton.vg);
|
|
- return 1;
|
|
- }
|
|
- }
|
|
-
|
|
ret = _online_pv_found(cmd, dev, dev_args, baton.vg, found_vgnames);
|
|
|
|
/*
|
|
--
|
|
2.23.0
|
|
|