diff --git a/backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch b/backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch new file mode 100644 index 0000000000000000000000000000000000000000..b4ccd978b82a5ff6ddb6e86108cb30bda0ffb919 --- /dev/null +++ b/backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch @@ -0,0 +1,54 @@ +From 1af46743195422aaebcde5c508a5dd479eff51ea Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Fri, 10 Dec 2021 12:51:26 -0600 +Subject: [PATCH] feat(lvm): only run lvchange for LV that is seen on devices + +Change the command listing LVs from lvscan to lvs, and list +only the LV names that are being activated. Before attempting +to activate an LV, check that that LV name appears in the +lvs command output. This avoids wasting time running an +lvchange command that we know will fail. +--- + modules.d/90lvm/lvm_scan.sh | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index bda265f..89f077a 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -119,7 +119,7 @@ sub=${sub%%\(*} + # ignores locking failures (--ignorelockingfailure) + # disables hints (--nohints) + # +-# For lvscan and vgscan: ++# For lvs and vgscan: + # disable locking (--nolocking) + # disable hints (--nohints) + +@@ -136,10 +136,20 @@ check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \ + if [ -n "$LVS" ]; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" + # shellcheck disable=SC2086 +- lvm lvscan $scan_args 2>&1 | vinfo ++ LVSLIST=$(lvm lvs $scan_args --noheading -o lv_full_name,segtype $LVS) ++ info "$LVSLIST" ++ ++ # Only attempt to activate an LV if it appears in the lvs output. + for LV in $LVS; do +- # shellcheck disable=SC2086 +- lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo ++ if strstr "$LVSLIST" "$LV"; then ++ # This lvchange is expected to fail if all PVs used by ++ # the LV are not yet present. Premature/failed lvchange ++ # could be avoided by reporting if an LV is complete ++ # from the lvs command above and skipping this lvchange ++ # if the LV is not lised as complete. ++ # shellcheck disable=SC2086 ++ lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo ++ fi + done + fi + +-- +1.8.3.1 + diff --git a/backport-feat-lvm-update-lvm-command-options.patch b/backport-feat-lvm-update-lvm-command-options.patch new file mode 100644 index 0000000000000000000000000000000000000000..2ff0c377d364e72b9eeb29b211342b9120388b7b --- /dev/null +++ b/backport-feat-lvm-update-lvm-command-options.patch @@ -0,0 +1,83 @@ +From c0a54f2993b1d3c2101202c274a41f925445d54b Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 8 Dec 2021 14:43:58 -0600 +Subject: [PATCH] feat(lvm): update lvm command options + +Drop checking for options that have been available for +at least ten years. This simplifies code maintenance. + +Add the new --nohints option (when available) to disable +the use of hints which is not useful during startup. +--- + modules.d/90lvm/lvm_scan.sh | 41 ++++++++++++++++++++++------------------- + 1 file changed, 22 insertions(+), 19 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index 8038240..00143bf 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -59,39 +59,42 @@ min=$2 + sub=${3%% *} + sub=${sub%%\(*} + +-lvm_ignorelockingfailure="--ignorelockingfailure" +-lvm_quirk_args="--ignorelockingfailure --ignoremonitoring" +- +-check_lvm_ver 2 2 57 "$maj" "$min" "$sub" \ +- && lvm_quirk_args="$lvm_quirk_args --poll n" +- +-if check_lvm_ver 2 2 65 "$maj" "$min" "$sub"; then +- lvm_quirk_args=" --sysinit $extraargs" +-fi +- +-if check_lvm_ver 2 2 221 "$maj" "$min" "$sub"; then +- lvm_quirk_args=" $extraargs" +- unset lvm_ignorelockingfailure +-fi +- ++# For lvchange and vgchange use --sysinit which: ++# disables polling (--poll n) ++# ignores monitoring (--ignoremonitoring) ++# ignores locking failures (--ignorelockingfailure) ++# disables hints (--nohints) ++# ++# For lvscan and vgscan: ++# disable locking (--nolocking) ++# disable hints (--nohints) ++ ++activate_args="--sysinit $extraargs" + unset extraargs + + export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 + ++scan_args="--nolocking" ++ ++check_lvm_ver 2 3 14 "$maj" "$min" "$sub" \ ++ && scan_args="$scan_args --nohints" ++ + if [ -n "$LVS" ]; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" +- lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo ++ # shellcheck disable=SC2086 ++ lvm lvscan $scan_args 2>&1 | vinfo + for LV in $LVS; do + # shellcheck disable=SC2086 +- lvm lvchange --yes -K -ay $lvm_quirk_args "$LV" 2>&1 | vinfo ++ lvm lvchange --yes -K -ay $activate_args "$LV" 2>&1 | vinfo + done + fi + + if [ -z "$LVS" ] || [ -n "$VGS" ]; then + info "Scanning devices $lvmdevs for LVM volume groups $VGS" +- lvm vgscan $lvm_ignorelockingfailure 2>&1 | vinfo + # shellcheck disable=SC2086 +- lvm vgchange -ay $lvm_quirk_args $VGS 2>&1 | vinfo ++ lvm vgscan $scan_args 2>&1 | vinfo ++ # shellcheck disable=SC2086 ++ lvm vgchange -ay $activate_args $VGS 2>&1 | vinfo + fi + + if [ "$lvmwritten" ]; then +-- +1.8.3.1 + diff --git a/backport-feat-lvm-use-generated-filter-when-none-is-set.patch b/backport-feat-lvm-use-generated-filter-when-none-is-set.patch new file mode 100644 index 0000000000000000000000000000000000000000..d3da4812ccefd477368b395bf48324241700a8d8 --- /dev/null +++ b/backport-feat-lvm-use-generated-filter-when-none-is-set.patch @@ -0,0 +1,141 @@ +From 7ffc5e388bcce20785803825bdd260c3c854b34f Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 8 Dec 2021 15:16:03 -0600 +Subject: [PATCH] feat(lvm): use generated filter when none is set + +Previously, the lvm device filter generated by dracut +would not be used if any lvm.conf file existed in the +initrd. Change this so that the generated filter will +be used when the included lvm.conf has no filter set. +--- + modules.d/90lvm/lvm_scan.sh | 91 +++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 75 insertions(+), 16 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index 00143bf..bda265f 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -10,6 +10,7 @@ LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=) + + # shellcheck disable=SC2174 + [ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm ++[ -d /run/lvm ] || mkdir -m 0755 -p /run/lvm + # build a list of devices to scan + lvmdevs=$( + for f in /tmp/.lvm_scan-*; do +@@ -18,22 +19,6 @@ lvmdevs=$( + done + ) + +-if [ ! -e /etc/lvm/lvm.conf ]; then +- { +- echo 'devices {' +- printf ' filter = [ ' +- for dev in $lvmdevs; do +- printf '"a|^/dev/%s$|", ' "$dev" +- done +- echo '"r/.*/" ]' +- echo '}' +- +- echo 'global {' +- echo '}' +- } > /etc/lvm/lvm.conf +- lvmwritten=1 +-fi +- + check_lvm_ver() { + maj=$1 + min=$2 +@@ -47,6 +32,75 @@ check_lvm_ver() { + return 1 + } + ++no_lvm_conf_filter() { ++ if [ ! -e /etc/lvm/lvm.conf ]; then ++ return 0 ++ fi ++ ++ if [ -e /run/lvm/initrd_no_filter ]; then ++ return 0 ++ fi ++ ++ if [ -e /run/lvm/initrd_filter ]; then ++ return 1 ++ fi ++ ++ if [ -e /run/lvm/initrd_global_filter ]; then ++ return 1 ++ fi ++ ++ # Save lvm config results in /run to avoid running ++ # lvm config commands for every PV that's scanned. ++ ++ filter=$(lvm config devices/filter | grep "$filter=") ++ if [ -n "$filter" ]; then ++ printf '%s\n' "$filter" > /run/lvm/initrd_filter ++ return 1 ++ fi ++ ++ global_filter=$(lvm config devices/global_filter | grep "$global_filter=") ++ if [ -n "$global_filter" ]; then ++ printf '%s\n' "$global_filter" > /run/lvm/initrd_global_filter ++ return 1 ++ fi ++ ++ # /etc/lvm/lvm.conf exists with no filter setting ++ true > /run/lvm/initrd_no_filter ++ return 0 ++} ++ ++# If no lvm.conf exists, create a basic one with a global section. ++if [ ! -e /etc/lvm/lvm.conf ]; then ++ { ++ echo 'global {' ++ echo '}' ++ } > /etc/lvm/lvm.conf ++ lvmwritten=1 ++fi ++ ++# Save the original lvm.conf before appending a filter setting. ++if [ ! -e /etc/lvm/lvm.conf.orig ]; then ++ cp /etc/lvm/lvm.conf /etc/lvm/lvm.conf.orig ++fi ++ ++# If the original lvm.conf does not contain a filter setting, ++# then generate a filter and append it to the original lvm.conf. ++# The filter is generated from the list PVs that have been seen ++# so far (each has been processed by the lvm udev rule.) ++if no_lvm_conf_filter; then ++ { ++ echo 'devices {' ++ printf ' filter = [ ' ++ for dev in $lvmdevs; do ++ printf '"a|^/dev/%s$|", ' "$dev" ++ done ++ echo '"r/.*/" ]' ++ echo '}' ++ } > /etc/lvm/lvm.conf.filter ++ lvmfilter=1 ++ cat /etc/lvm/lvm.conf.orig /etc/lvm/lvm.conf.filter > /etc/lvm/lvm.conf ++fi ++ + # hopefully this output format will never change, e.g.: + # LVM version: 2.02.53(1) (2009-09-25) + OLDIFS=$IFS +@@ -99,8 +153,13 @@ fi + + if [ "$lvmwritten" ]; then + rm -f -- /etc/lvm/lvm.conf ++elif [ "$lvmfilter" ]; then ++ # revert filter that was appended to existing lvm.conf ++ cp /etc/lvm/lvm.conf.orig /etc/lvm/lvm.conf ++ rm -f -- /etc/lvm/lvm.conf.filter + fi + unset lvmwritten ++unset lvmfilter + + udevadm settle + +-- +1.8.3.1 + diff --git a/backport-fix-lvm-replace-partial-option.patch b/backport-fix-lvm-replace-partial-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..c1a687d03e6c0c7169adb93026e6f614d37a435e --- /dev/null +++ b/backport-fix-lvm-replace-partial-option.patch @@ -0,0 +1,30 @@ +From 97543cca48dfde849396f11c83f9c320e1b91c46 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 8 Dec 2021 14:14:27 -0600 +Subject: [PATCH] fix(lvm): replace --partial option + +The --partial option will activate a linear (or other) LV +without segments for missing devices, which is unlikely to +be useful. The intention was to activate raid LVs in a useful +form while missing devices, which is specified with the option +--activationmode degraded. +--- + modules.d/90lvm/64-lvm.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules +index 65f6524..ca718ce 100644 +--- a/modules.d/90lvm/64-lvm.rules ++++ b/modules.d/90lvm/64-lvm.rules +@@ -15,7 +15,7 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && + GOTO="lvm_end" + + RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan" +-RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --partial" ++RUN+="/sbin/initqueue --timeout --name 51-lvm_scan --onetime --unique /sbin/lvm_scan --activationmode degraded" + RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'" + + LABEL="lvm_end" +-- +1.8.3.1 + diff --git a/backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch b/backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch new file mode 100644 index 0000000000000000000000000000000000000000..72083da01607809bd07908fb6ca385babe9b30ae --- /dev/null +++ b/backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch @@ -0,0 +1,38 @@ +From 164e5ebb1199ea3e3d641ce402d8257f0055a529 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Fri, 17 Dec 2021 12:14:51 -0600 +Subject: [PATCH] fix(lvm): restore setting LVM_MD_PV_ACTIVATED + +The 69-dm-lvm-metad.rules udev rule has been removed from +the initrd, because it's been dropped by recent upstream +lvm versions, and it never performed any primary function +within the initrd. But, it did have the job of setting +LVM_MD_PV_ACTIVATED=1 for active md devices used by PVs. +That step needs to be restored, and is now included in +64-lvm.rules. +--- + modules.d/90lvm/64-lvm.rules | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/modules.d/90lvm/64-lvm.rules b/modules.d/90lvm/64-lvm.rules +index ca718ce..1ad4911 100644 +--- a/modules.d/90lvm/64-lvm.rules ++++ b/modules.d/90lvm/64-lvm.rules +@@ -6,6 +6,14 @@ + + SUBSYSTEM!="block", GOTO="lvm_end" + ACTION!="add|change", GOTO="lvm_end" ++ ++# If the md device is active (indicated by array_state), then set the flag ++# LVM_MD_PV_ACTIVATED=1 indicating that the md device for the PV is ready ++# to be used. The lvm udev rule running in root will check that this flag ++# is set before it will process the md device (it wants to avoid ++# processing an md device that exists but is not yet ready to be used.) ++KERNEL=="md[0-9]*", ACTION=="change", ENV{ID_FS_TYPE}=="LVM2_member", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1" ++ + # Also don't process disks that are slated to be a multipath device + ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end" + KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end" +-- +1.8.3.1 + diff --git a/backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch b/backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch new file mode 100644 index 0000000000000000000000000000000000000000..e35c1d648d86786464ac8c9939488b8f78e569fb --- /dev/null +++ b/backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch @@ -0,0 +1,44 @@ +From 50e74668434d935db649b5690dc2158b0f87d91c Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 8 Dec 2021 14:11:13 -0600 +Subject: [PATCH] revert(lvm): remove 69-dm-lvm-metad.rules + +This udev rule runs pvscan to autoactivate VGs, which dracut +does not want to do, and previously disabled by editing the +rule file and commenting out lines. + +This also stops /dev/disk/by-id/lvm-pv-uuid-* symlinks from +being created in the initrd. +--- + modules.d/90lvm/module-setup.sh | 15 +-------------- + 1 file changed, 1 insertion(+), 14 deletions(-) + +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index 0bb491f..25be013 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -78,20 +78,7 @@ install() { + unset LVM_SUPPRESS_FD_WARNINGS + fi + +- inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules +- +- # Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut! +- if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]]; then +- if grep -q SYSTEMD_WANTS "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules; then +- sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' \ +- "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- sed -i -e 's/^ENV{ID_MODEL}=.*//' "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- sed -i -e 's/^ENV{SYSTEMD_WANTS}+\?=.*//' "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- else +- sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' \ +- "${initdir}"/lib/udev/rules.d/69-dm-lvm-metad.rules +- fi +- fi ++ inst_rules 11-dm-lvm.rules + + # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules + # files, but provides the one below: +-- +1.8.3.1 + diff --git a/backport-revert-lvm-remove-lvmetad-config-changes.patch b/backport-revert-lvm-remove-lvmetad-config-changes.patch new file mode 100644 index 0000000000000000000000000000000000000000..977c24a0c573d57b2885467d91aa4bcf7e831626 --- /dev/null +++ b/backport-revert-lvm-remove-lvmetad-config-changes.patch @@ -0,0 +1,69 @@ +From f6f393f550625e3e1c968ef32d6d7bdd90f51d73 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 8 Dec 2021 14:07:42 -0600 +Subject: [PATCH] revert(lvm): remove lvmetad config changes + +Remove support for modifying use_lvmetad and locking_type +settings in lvm.conf for lvm versions 2.2.*. Recent lvm +versions (2.3.*) do not include lvmetad or locking_type. +This cleanup simplifies code maintenance. + +To use the lvm module with older versions (2.2), a user +would need to ensure that lvmetad settings are disabled +in the initrd's lvm.conf rather than relying on the lvm +dracut mode to modify their lvm.conf. +--- + modules.d/90lvm/lvm_scan.sh | 3 --- + modules.d/90lvm/module-setup.sh | 14 -------------- + 2 files changed, 17 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index 43601ad..8038240 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -28,10 +28,7 @@ if [ ! -e /etc/lvm/lvm.conf ]; then + echo '"r/.*/" ]' + echo '}' + +- # establish LVM locking + echo 'global {' +- echo ' locking_type = 4' +- echo ' use_lvmetad = 0' + echo '}' + } > /etc/lvm/lvm.conf + lvmwritten=1 +diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh +index e1e6c58..0bb491f 100755 +--- a/modules.d/90lvm/module-setup.sh ++++ b/modules.d/90lvm/module-setup.sh +@@ -61,10 +61,6 @@ install() { + if [[ $hostonly ]] || [[ $lvmconf == "yes" ]]; then + if [[ -f $dracutsysrootdir/etc/lvm/lvm.conf ]]; then + inst_simple -H /etc/lvm/lvm.conf +- # FIXME: near-term hack to establish read-only locking; +- # use command-line lvm.conf editor once it is available +- sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' "${initdir}/etc/lvm/lvm.conf" +- sed -i -e 's/\(^[[:space:]]*\)use_lvmetad[[:space:]]*=[[:space:]]*[[:digit:]]/\1use_lvmetad = 0/' "${initdir}/etc/lvm/lvm.conf" + fi + + export LVM_SUPPRESS_FD_WARNINGS=1 +@@ -82,16 +78,6 @@ install() { + unset LVM_SUPPRESS_FD_WARNINGS + fi + +- if ! [[ -e ${initdir}/etc/lvm/lvm.conf ]]; then +- mkdir -p "${initdir}/etc/lvm" +- { +- echo 'global {' +- echo 'locking_type = 4' +- echo 'use_lvmetad = 0' +- echo '}' +- } > "${initdir}/etc/lvm/lvm.conf" +- fi +- + inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules + + # Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut! +-- +1.8.3.1 + diff --git a/backport-revert-lvm-remove-snapshot-feature.patch b/backport-revert-lvm-remove-snapshot-feature.patch new file mode 100644 index 0000000000000000000000000000000000000000..bba82e5d953ea850d2633d2e812c0fb162761ee4 --- /dev/null +++ b/backport-revert-lvm-remove-snapshot-feature.patch @@ -0,0 +1,79 @@ +From 1549d5e89818603e1aa6dd8a40981222f59f1548 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 8 Dec 2021 14:04:25 -0600 +Subject: [PATCH] revert(lvm): remove snapshot feature + +The feature of managing lvm snapshots has no known +recent usage. It is unknown if it works. The lvm +developers do not wish to maintain or support it. +--- + modules.d/90lvm/lvm_scan.sh | 39 ++++----------------------------------- + 1 file changed, 4 insertions(+), 35 deletions(-) + +diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh +index c42f97d..43601ad 100755 +--- a/modules.d/90lvm/lvm_scan.sh ++++ b/modules.d/90lvm/lvm_scan.sh +@@ -7,8 +7,6 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh + + VGS=$(getargs rd.lvm.vg -d rd_LVM_VG=) + LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=) +-SNAPSHOT=$(getargs rd.lvm.snapshot -d rd_LVM_SNAPSHOT=) +-SNAPSIZE=$(getargs rd.lvm.snapsize -d rd_LVM_SNAPSIZE=) + + # shellcheck disable=SC2174 + [ -d /etc/lvm ] || mkdir -m 0755 -p /etc/lvm +@@ -31,17 +29,10 @@ if [ ! -e /etc/lvm/lvm.conf ]; then + echo '}' + + # establish LVM locking +- if [ -n "$SNAPSHOT" ]; then +- echo 'global {' +- echo ' locking_type = 1' +- echo ' use_lvmetad = 0' +- echo '}' +- else +- echo 'global {' +- echo ' locking_type = 4' +- echo ' use_lvmetad = 0' +- echo '}' +- fi ++ echo 'global {' ++ echo ' locking_type = 4' ++ echo ' use_lvmetad = 0' ++ echo '}' + } > /etc/lvm/lvm.conf + lvmwritten=1 + fi +@@ -90,28 +81,6 @@ unset extraargs + + export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 + +-if [ -n "$SNAPSHOT" ]; then +- # HACK - this should probably be done elsewhere or turned into a function +- # Enable read-write LVM locking +- sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 1/' /etc/lvm/lvm.conf +- +- # Expected SNAPSHOT format ":" +- ORIG_LV=${SNAPSHOT%%:*} +- SNAP_LV=${SNAPSHOT##*:} +- +- info "Removing existing LVM snapshot $SNAP_LV" +- lvm lvremove --force "$SNAP_LV" 2>&1 | vinfo +- +- # Determine snapshot size +- if [ -z "$SNAPSIZE" ]; then +- SNAPSIZE=$(lvm lvs --noheadings --units m --options lv_size "$ORIG_LV") +- info "No LVM snapshot size provided, using size of $ORIG_LV ($SNAPSIZE)" +- fi +- +- info "Creating LVM snapshot $SNAP_LV ($SNAPSIZE)" +- lvm lvcreate -s -n "$SNAP_LV" -L "$SNAPSIZE" "$ORIG_LV" 2>&1 | vinfo +-fi +- + if [ -n "$LVS" ]; then + info "Scanning devices $lvmdevs for LVM logical volumes $LVS" + lvm lvscan $lvm_ignorelockingfailure 2>&1 | vinfo +-- +1.8.3.1 + diff --git a/dracut.spec b/dracut.spec index ffa3d4924f22c57f802edba03957aa7d53e4a265..c8747ce3381ddfee4159246c6c7c010ad4b0b69b 100644 --- a/dracut.spec +++ b/dracut.spec @@ -9,7 +9,7 @@ Name: dracut Version: 055 -Release: 3 +Release: 4 Summary: Initramfs generator using udev @@ -24,12 +24,20 @@ URL: https://dracut.wiki.kernel.org/ Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz #Source0: https://git.kernel.org/pub/scm/boot/dracut/dracut.git/snapshot/dracut-%{version}.tar.gz -Patch1: dracut-network-fixed-net-rules-issue-hence-systemd-r.patch -Patch2: skip-the-broken-sd-in-initqueue.patch -Patch3: use-sleep-replace-check-sys-block.patch -Patch4: add-option-to-include-file-metadata-in-initramfs.patch -Patch5: revert-fix-systemd-networkd-make-systemd-networkd.patch -Patch6: make-network-legacy-instead-of-network-manager-the-network.patch +Patch1: dracut-network-fixed-net-rules-issue-hence-systemd-r.patch +Patch2: skip-the-broken-sd-in-initqueue.patch +Patch3: use-sleep-replace-check-sys-block.patch +Patch4: add-option-to-include-file-metadata-in-initramfs.patch +Patch5: revert-fix-systemd-networkd-make-systemd-networkd.patch +Patch6: make-network-legacy-instead-of-network-manager-the-network.patch +Patch7: backport-revert-lvm-remove-snapshot-feature.patch +Patch8: backport-revert-lvm-remove-lvmetad-config-changes.patch +Patch9: backport-revert-lvm-remove-69-dm-lvm-metad.rules.patch +Patch10: backport-fix-lvm-replace-partial-option.patch +Patch11: backport-feat-lvm-update-lvm-command-options.patch +Patch12: backport-feat-lvm-use-generated-filter-when-none-is-set.patch +Patch13: backport-feat-lvm-only-run-lvchange-for-LV-that-is-seen-on-de.patch +Patch14: backport-fix-lvm-restore-setting-LVM_MD_PV_ACTIVATED.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt Source2: openEuler.conf.example @@ -499,6 +507,9 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %endif %changelog +* Wed Feb 16 2022 panxiaohe - 055-4 +- backport patches from upstream: improve lvm module + * Mon Jan 17 2022 panxiaohe - 055-3 - make network-legacy instead of network-manager the network provider