import lvm2-2.03.14-4.el9

This commit is contained in:
CentOS Sources 2022-03-01 08:12:27 -05:00 committed by Stepan Oksanichenko
parent 9a4c5e716d
commit b187147277
7 changed files with 175 additions and 129 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/LVM2.2.03.14.tgz
SOURCES/lvm2-4a1f617.tgz

View File

@ -1 +1 @@
e5d4364e823d72b9a08b3aecc13cd677972830f0 SOURCES/LVM2.2.03.14.tgz
b87a5a886c6cceb6e38028f1ea20d5d1d6bd23a8 SOURCES/lvm2-4a1f617.tgz

View File

@ -0,0 +1,144 @@
From 611c3f868699471c474e12280825242978c0bed8 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 10 Feb 2022 14:00:25 -0600
Subject: [PATCH] devices file: do not clear PVID of unread devices
In a certain disconnected state, a block device is present on
the system, can be opened, reports a valid size, reports the
correct device id (wwid), and matches a devices file entry.
But, reading the device can still fail. In this case,
device_ids_validate() was misinterpreting the read error as
the device having no data/label on it (and no PVID).
The validate function would then clear the PVID from the
devices file entry for the device, thinking that it was
fixing the devices file (making it consistent with the on disk
state.) Fix this by not attempting to check and correct a
devices file entry that cannot be read. Also make this case
explicit in the hints validation code (which was doing the
right thing but indirectly.)
---
lib/device/device.h | 1 +
lib/device/device_id.c | 14 ++++++++++++++
lib/label/hints.c | 14 ++++++++++++++
lib/label/label.c | 8 ++++++++
4 files changed, 37 insertions(+)
diff --git a/lib/device/device.h b/lib/device/device.h
index 9e471a9b5..8c3a8c30e 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -40,6 +40,7 @@
#define DEV_IS_NVME 0x00040000 /* set if dev is nvme */
#define DEV_MATCHED_USE_ID 0x00080000 /* matched an entry from cmd->use_devices */
#define DEV_SCAN_FOUND_NOLABEL 0x00100000 /* label_scan read, passed filters, but no lvm label */
+#define DEV_SCAN_NOT_READ 0x00200000 /* label_scan not able to read dev */
/*
* Support for external device info.
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 4618247ba..003f10a96 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1746,6 +1746,13 @@ void device_ids_validate(struct cmd_context *cmd, struct dm_list *scanned_devs,
if (scanned_devs && !dev_in_device_list(dev, scanned_devs))
continue;
+ /*
+ * The matched device could not be read so we do not have
+ * the PVID from disk and cannot verify the devices file entry.
+ */
+ if (dev->flags & DEV_SCAN_NOT_READ)
+ continue;
+
/*
* du and dev may have been matched, but the dev could still
* have been excluded by other filters during label scan.
@@ -1828,6 +1835,13 @@ void device_ids_validate(struct cmd_context *cmd, struct dm_list *scanned_devs,
if (scanned_devs && !dev_in_device_list(dev, scanned_devs))
continue;
+ /*
+ * The matched device could not be read so we do not have
+ * the PVID from disk and cannot verify the devices file entry.
+ */
+ if (dev->flags & DEV_SCAN_NOT_READ)
+ continue;
+
if (!cmd->filter->passes_filter(cmd, cmd->filter, dev, "persistent")) {
log_warn("Devices file %s is excluded by filter: %s.",
dev_name(dev), dev_filtered_reason(dev));
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 93dfdd5c1..35ae7f5cc 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -236,6 +236,7 @@ static int _touch_newhints(void)
return_0;
if (fclose(fp))
stack;
+ log_debug("newhints created");
return 1;
}
@@ -506,6 +507,19 @@ int validate_hints(struct cmd_context *cmd, struct dm_list *hints)
if (!hint->chosen)
continue;
+ /*
+ * label_scan was unable to read the dev so we don't know its pvid.
+ * Since we are unable to verify the hint is correct, it's possible
+ * that the PVID is actually found on a different device, so don't
+ * depend on hints. (This would also fail the following pvid check.)
+ */
+ if (dev->flags & DEV_SCAN_NOT_READ) {
+ log_debug("Uncertain hint for unread device %d:%d %s",
+ major(hint->devt), minor(hint->devt), dev_name(dev));
+ ret = 0;
+ continue;
+ }
+
if (strcmp(dev->pvid, hint->pvid)) {
log_debug("Invalid hint device %d:%d %s pvid %s had hint pvid %s",
major(hint->devt), minor(hint->devt), dev_name(dev),
diff --git a/lib/label/label.c b/lib/label/label.c
index 5c77a6923..4f29d6208 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -687,6 +687,8 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
dm_list_iterate_items_safe(devl, devl2, devs) {
+ devl->dev->flags &= ~DEV_SCAN_NOT_READ;
+
/*
* If we prefetch more devs than blocks in the cache, then the
* cache will wait for earlier reads to complete, toss the
@@ -702,6 +704,7 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
log_debug_devs("Scan failed to open %s.", dev_name(devl->dev));
dm_list_del(&devl->list);
dm_list_add(&reopen_devs, &devl->list);
+ devl->dev->flags |= DEV_SCAN_NOT_READ;
continue;
}
}
@@ -725,6 +728,7 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
log_debug_devs("Scan failed to read %s.", dev_name(devl->dev));
scan_read_errors++;
scan_failed_count++;
+ devl->dev->flags |= DEV_SCAN_NOT_READ;
lvmcache_del_dev(devl->dev);
if (bb)
bcache_put(bb);
@@ -1389,6 +1393,10 @@ int label_scan(struct cmd_context *cmd)
* filter", and this result needs to be cleared (wiped) so that the
* complete set of filters (including those that require data) can be
* checked in _process_block, where headers have been read.
+ *
+ * FIXME: devs that are filtered with data in _process_block
+ * are not moved to the filtered_devs list like devs filtered
+ * here without data. Does that have any effect?
*/
log_debug_devs("Filtering devices to scan (nodata)");
--
2.34.1

View File

@ -1,25 +0,0 @@
From bea731e8f60bb5d221483a8ccb398fd0e469e908 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 2 Dec 2021 12:40:52 -0600
Subject: [PATCH 1/3] print warning about unrecognized journal option value
(cherry picked from commit 455c29b10dfd15a9fa2ad72c8f9de77572328d39)
---
lib/log/log.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/log/log.c b/lib/log/log.c
index 7b4d537b3..5771a1d01 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -892,6 +892,7 @@ uint32_t log_journal_str_to_val(const char *str)
return LOG_JOURNAL_OUTPUT;
if (!strcasecmp(str, "debug"))
return LOG_JOURNAL_DEBUG;
+ log_warn("Ignoring unrecognized journal value.");
return 0;
}
--
2.31.1

View File

@ -1,37 +0,0 @@
From 9bd979855bd00851540fb647d7be01271a905e72 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 13 Dec 2021 08:59:31 -0600
Subject: [PATCH 2/3] lvcreate: include recent options
The permitted option list in lvcreate has not kept
up with command-lines.in.
(cherry picked from commit c28541eccdbf76191f7728035cd2a48d26d06922)
---
tools/lvcreate.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 0121c09a8..79af42685 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -824,12 +824,16 @@ static int _lvcreate_params(struct cmd_context *cmd,
autobackup_ARG,\
available_ARG,\
contiguous_ARG,\
+ devices_ARG,\
+ devicesfile_ARG,\
ignoreactivationskip_ARG,\
ignoremonitoring_ARG,\
+ journal_ARG,\
metadataprofile_ARG,\
monitor_ARG,\
mirrors_ARG,\
name_ARG,\
+ nohints_ARG,\
noudevsync_ARG,\
permission_ARG,\
persistent_ARG,\
--
2.31.1

View File

@ -1,55 +0,0 @@
From c265ff79d34e1c1c76db360a7c056c95c32ce216 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 2 Dec 2021 13:30:36 -0600
Subject: [PATCH 3/3] device_id: handle wwid with spaces or control characters
non-standard wwid can be reported from sysfs with spaces/etc.
replace with "_"
(cherry picked from commit ae54e75176d787de2d447ec40142f85f4dcc47c4)
---
lib/device/device_id.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 167bf661b..8b822e4c0 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -302,6 +302,7 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
{
char sysbuf[PATH_MAX] = { 0 };
const char *idname = NULL;
+ int i;
if (idtype == DEV_ID_TYPE_SYS_WWID) {
read_sys_block(cmd, dev, "device/wwid", sysbuf, sizeof(sysbuf));
@@ -309,13 +310,10 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
if (!sysbuf[0])
read_sys_block(cmd, dev, "wwid", sysbuf, sizeof(sysbuf));
- /* scsi_debug wwid begins "t10.Linux scsi_debug ..." */
- if (strstr(sysbuf, "scsi_debug"))
- sysbuf[0] = '\0';
-
/* qemu wwid begins "t10.ATA QEMU HARDDISK ..." */
if (strstr(sysbuf, "QEMU HARDDISK"))
sysbuf[0] = '\0';
+
}
else if (idtype == DEV_ID_TYPE_SYS_SERIAL)
@@ -353,6 +351,11 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
return idname;
}
+ for (i = 0; i < strlen(sysbuf); i++) {
+ if (isblank(sysbuf[i]) || isspace(sysbuf[i]) || iscntrl(sysbuf[i]))
+ sysbuf[i] = '_';
+ }
+
if (!sysbuf[0])
goto_bad;
--
2.31.1

View File

@ -1,4 +1,4 @@
%global device_mapper_version 1.02.181
%global device_mapper_version 1.02.183
%global enable_cache 1
%global enable_cluster 1
@ -44,22 +44,35 @@
%global configure_cluster --with-cluster=internal
%endif
%global from_snapshot 1
%if 0%{?from_snapshot}
%global commit 4a1f6173d29a7d7ecab14a9313000aa5f81170d0
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%endif
#%%global rel_suffix .test
# Do not reset Release to 1 unless both lvm2 and device-mapper
# versions are increased together.
Summary: Userland logical volume management tools
Name: lvm2
%if 0%{?rhel}
Epoch: %{rhel}
%endif
Version: 2.03.14
Release: 3%{?dist}
%if 0%{?from_snapshot}
#Release: 0.1.20211115git%{shortcommit}%{?dist}%{?rel_suffix}
Release: 4%{?dist}
%else
Release: 1%{?dist}
%endif
License: GPLv2
URL: http://sourceware.org/lvm2
%if 0%{?from_snapshot}
Source0: lvm2-%{shortcommit}.tgz
%else
Source0: ftp://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz
Patch1: 0001-print-warning-about-unrecognized-journal-option-valu.patch
Patch2: 0002-lvcreate-include-recent-options.patch
Patch3: 0003-device_id-handle-wwid-with-spaces-or-control-charact.patch
%endif
Patch1: 0001-devices-file-do-not-clear-PVID-of-unread-devices.patch
BuildRequires: make
BuildRequires: gcc
@ -115,10 +128,12 @@ or more physical volumes and creating one or more logical volumes
(kind of logical partitions) in volume groups.
%prep
%if 0%{?from_snapshot}
%setup -q -n lvm2-%{commit}
%else
%setup -q -n LVM2.%{version}
%endif
%patch1 -p1 -b .backup1
%patch2 -p1 -b .backup2
%patch3 -p1 -b .backup3
%build
%global _default_pid_dir /run
@ -297,6 +312,7 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || :
%{_sbindir}/vgscan
%{_sbindir}/vgsplit
%{_mandir}/man5/lvm.conf.5.gz
%{_mandir}/man7/lvmautoactivation.7.gz
%{_mandir}/man7/lvmcache.7.gz
%{_mandir}/man7/lvmraid.7.gz
%{_mandir}/man7/lvmreport.7.gz
@ -310,7 +326,6 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || :
%{_mandir}/man8/lvdisplay.8.gz
%{_mandir}/man8/lvextend.8.gz
%{_mandir}/man8/lvm.8.gz
%{_mandir}/man8/lvm2-activation-generator.8.gz
%{_mandir}/man8/lvm-config.8.gz
%{_mandir}/man8/lvmconfig.8.gz
%{_mandir}/man8/lvmdevices.8.gz
@ -386,7 +401,6 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || :
%{_unitdir}/blk-availability.service
%{_unitdir}/lvm2-monitor.service
#%%{_unitdir}/lvm-vgchange@.service # vgchange is now part of udev rule
%attr(555, -, -) %{_prefix}/lib/systemd/system-generators/lvm2-activation-generator
%if %{enable_lvmpolld}
%{_unitdir}/lvm2-lvmpolld.socket
%{_unitdir}/lvm2-lvmpolld.service
@ -690,6 +704,11 @@ An extensive functional testsuite for LVM2.
%endif
%changelog
* Tue Feb 15 2022 Marian Csontos <mcsontos@redhat.com> - 2.03.14-4
- Remove service based autoactivation.
- New lvmautoactivation(7) man page.
- Fix missing PVIDs for multipath devices in system.devices file.
* Fri Nov 19 2021 Marian Csontos <mcsontos@redhat.com> - 2.03.14-3
- Fix gating tests.