Accepting request 734724 from Base:System
OBS-URL: https://build.opensuse.org/request/show/734724 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lvm2?expand=0&rev=127
This commit is contained in:
commit
04f9f4a3bf
@ -0,0 +1,63 @@
|
||||
From f17353e3e604ad2d80bcd77ea0a6a93472e6b5bd Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Tue, 9 Jul 2019 13:32:41 -0500
|
||||
Subject: [PATCH] md component detection for differing PV and device sizes
|
||||
|
||||
This check was mistakenly removed when shifting code in commit
|
||||
"separate code for setting devices from metadata parsing".
|
||||
|
||||
Put it back with some new conditions.
|
||||
---
|
||||
lib/metadata/metadata.c | 26 ++++++++++++++++++++++++--
|
||||
1 file changed, 24 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
|
||||
index 121cf4f..f19df3d 100644
|
||||
--- a/lib/metadata/metadata.c
|
||||
+++ b/lib/metadata/metadata.c
|
||||
@@ -3504,18 +3504,40 @@ static void _set_pv_device(struct format_instance *fid,
|
||||
struct physical_volume *pv)
|
||||
{
|
||||
char buffer[64] __attribute__((aligned(8)));
|
||||
+ struct cmd_context *cmd = fid->fmt->cmd;
|
||||
+ struct device *dev;
|
||||
uint64_t size;
|
||||
|
||||
- if (!(pv->dev = lvmcache_device_from_pvid(fid->fmt->cmd, &pv->id, &pv->label_sector))) {
|
||||
+ if (!(dev = lvmcache_device_from_pvid(cmd, &pv->id, &pv->label_sector))) {
|
||||
if (!id_write_format(&pv->id, buffer, sizeof(buffer)))
|
||||
buffer[0] = '\0';
|
||||
|
||||
- if (fid->fmt->cmd && !fid->fmt->cmd->pvscan_cache_single)
|
||||
+ if (cmd && !cmd->pvscan_cache_single)
|
||||
log_warn("WARNING: Couldn't find device with uuid %s.", buffer);
|
||||
else
|
||||
log_debug_metadata("Couldn't find device with uuid %s.", buffer);
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * If the device and PV are not the size, it's a clue that we might
|
||||
+ * be reading an MD component (but not necessarily). Skip this check:
|
||||
+ * . if md component detection is disabled
|
||||
+ * . if we are already doing full a md check in label scan
|
||||
+ * . if md_component_checks is auto, not none (full means use_full_md_check is set)
|
||||
+ */
|
||||
+ if (dev && (pv->size != dev->size) && cmd &&
|
||||
+ cmd->md_component_detection &&
|
||||
+ !cmd->use_full_md_check &&
|
||||
+ !strcmp(cmd->md_component_checks, "auto")) {
|
||||
+ if (dev_is_md_component(dev, NULL, 1)) {
|
||||
+ log_warn("WARNING: device %s is an md component, not setting device for PV.",
|
||||
+ dev_name(dev));
|
||||
+ dev = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ pv->dev = dev;
|
||||
+
|
||||
/*
|
||||
* A previous command wrote the VG while this dev was missing, so
|
||||
* the MISSING flag was included in the PV.
|
||||
--
|
||||
2.23.0
|
||||
|
@ -0,0 +1,79 @@
|
||||
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
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 2 10:28:33 UTC 2019 - Martin Wilck <mwilck@suse.com>
|
||||
|
||||
- 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
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 9 12:00:00 UTC 2019 - heming.zhao@suse.com
|
||||
|
||||
|
@ -58,6 +58,8 @@ Source99: baselibs.conf
|
||||
Patch0001: bug-1122666_devices-drop-open-error-message.patch
|
||||
Patch0002: bug-1149408_Fix-rounding-writes-up-to-sector-size.patch
|
||||
Patch0003: bug-1149408_vgcreate-vgextend-restrict-PVs-with-mixed-block-size.patch
|
||||
Patch0004: bug-1152378-md-component-detection-for-differing-PV-and-device-s.patch
|
||||
Patch0005: bug-1152378-pvscan-fix-PV-online-when-device-has-a-different-siz.patch
|
||||
# SUSE patches: 1000+ for LVM
|
||||
# Never upstream
|
||||
Patch1001: cmirrord_remove_date_time_from_compilation.patch
|
||||
@ -115,6 +117,8 @@ Volume Manager.
|
||||
%patch0001 -p1
|
||||
%patch0002 -p1
|
||||
%patch0003 -p1
|
||||
%patch0004 -p1
|
||||
%patch0005 -p1
|
||||
%patch1001 -p1
|
||||
%patch1002 -p1
|
||||
%patch1003 -p1
|
||||
|
Loading…
x
Reference in New Issue
Block a user