From d2f393dd3c962ee25229fdd2385cfb781f566db0 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Mon, 10 Nov 2025 11:00:51 +0100 Subject: [PATCH] Additional patches for 9.8.0 lvm2 Resolves: RHEL-1939 --- ...LV-with-partial-snapshot-is-an-error.patch | 48 +++++++++++++ ...warning-during-classic-snapshot-crea.patch | 34 ++++++++++ ...t-for-snapshot-on-raid-creation-acti.patch | 67 +++++++++++++++++++ 0051-WHATS_NEW-update.patch | 36 ++++++++++ lvm2.spec | 9 ++- 5 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 0048-activating-raid-LV-with-partial-snapshot-is-an-error.patch create mode 100644 0049-lv_manip-show-a-warning-during-classic-snapshot-crea.patch create mode 100644 0050-test-add-new-test-for-snapshot-on-raid-creation-acti.patch create mode 100644 0051-WHATS_NEW-update.patch diff --git a/0048-activating-raid-LV-with-partial-snapshot-is-an-error.patch b/0048-activating-raid-LV-with-partial-snapshot-is-an-error.patch new file mode 100644 index 0000000..2c76d74 --- /dev/null +++ b/0048-activating-raid-LV-with-partial-snapshot-is-an-error.patch @@ -0,0 +1,48 @@ +From 52efa6f5a1a5a9057130d0b3c8acfdb8feff2e22 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Mon, 27 Oct 2025 11:01:16 -0500 +Subject: [PATCH] activating raid LV with partial snapshot is an error + +Detect and report this error early in the command, with +a clear message, including a possible remedy. Previously, +the command failed at a lower level, where the message is +confusing or even misleading. + +Old error message: + "Aborting. LV vg/snap1 is incomplete and --activationmode partial was not specified." + +New error message: + "Activating raid LV vg/main requires the removal of partial snapshot vg/snap1." + +(cherry picked from commit 2760e804630a36bab2c3938ce9ac0b08c5e75395) +--- + tools/toollib.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/tools/toollib.c b/tools/toollib.c +index a7384dd60..b9fa67446 100644 +--- a/tools/toollib.c ++++ b/tools/toollib.c +@@ -781,6 +781,19 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv, + } + } + ++ if (lv_is_raid(lv) && lv_is_origin(lv) && lv_is_partial(lv)) { ++ struct lv_list *lvl; ++ dm_list_iterate_items(lvl, &lv->vg->lvs) { ++ if (lv_is_cow(lvl->lv) && ++ (lv_origin_lv(lvl->lv) == lv) && ++ lv_is_partial(lvl->lv)) { ++ log_error("Activating raid LV %s requires the removal of partial snapshot %s.", ++ display_lvname(lv), display_lvname(lvl->lv)); ++ return 0; ++ } ++ } ++ } ++ + if (is_change_activating(activate) && + lvmcache_has_duplicate_devs() && + vg_has_duplicate_pvs(lv->vg) && +-- +2.51.1 + diff --git a/0049-lv_manip-show-a-warning-during-classic-snapshot-crea.patch b/0049-lv_manip-show-a-warning-during-classic-snapshot-crea.patch new file mode 100644 index 0000000..b51b006 --- /dev/null +++ b/0049-lv_manip-show-a-warning-during-classic-snapshot-crea.patch @@ -0,0 +1,34 @@ +From a71342640ddf81b73625e55149f1077245ee7412 Mon Sep 17 00:00:00 2001 +From: Heinz Mauelshagen +Date: Mon, 27 Oct 2025 17:37:09 +0100 +Subject: [PATCH 49/51] lv_manip: show a warning during classic snapshot + creation on a RaidLV. + +The RaidLV will fail to activate in case of the loss of any of its snapshots. +Once created, commit 2760e804630a36bab2c3938ce9ac0b08c5e75395 will +catch any loss of such snapshots and provide remedy information. + +(cherry picked from commit ae81b41811ede78b77f6badf0c65c88fa56cc951) +--- + lib/metadata/lv_manip.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index 577ffd0b3..e7405f1dc 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -9654,6 +9654,11 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, + goto revert_new_lv; + } + ++ if (lp->snapshot && origin_lv && lv_is_raid(origin_lv)) { ++ log_warn("WARNING: Loss of snapshot %s will cause the activation of the %s LV %s to fail!", ++ lp->lv_name, lvseg_name(first_seg(origin_lv)), display_lvname(origin_lv)); ++ } ++ + /* Do not scan this LV until properly zeroed/wiped. */ + if (_should_wipe_lv(lp, lv, 0)) + lv->status |= LV_NOSCAN; +-- +2.51.1 + diff --git a/0050-test-add-new-test-for-snapshot-on-raid-creation-acti.patch b/0050-test-add-new-test-for-snapshot-on-raid-creation-acti.patch new file mode 100644 index 0000000..662d6ab --- /dev/null +++ b/0050-test-add-new-test-for-snapshot-on-raid-creation-acti.patch @@ -0,0 +1,67 @@ +From 4ad6776b11103a864b98963c3540e87e13db2450 Mon Sep 17 00:00:00 2001 +From: Heinz Mauelshagen +Date: Mon, 27 Oct 2025 19:12:25 +0100 +Subject: [PATCH 50/51] test: add new test for snapshot on raid + creation/activation warning/error + +(cherry picked from commit 6704ef4012e8c187deaeadb1275e2d80661c3941) +--- + ...shot-create-warning-activate-error-raid.sh | 46 +++++++++++++++++++ + 1 file changed, 46 insertions(+) + create mode 100644 test/shell/snapshot-create-warning-activate-error-raid.sh + +diff --git a/test/shell/snapshot-create-warning-activate-error-raid.sh b/test/shell/snapshot-create-warning-activate-error-raid.sh +new file mode 100644 +index 000000000..c5b65d018 +--- /dev/null ++++ b/test/shell/snapshot-create-warning-activate-error-raid.sh +@@ -0,0 +1,46 @@ ++#!/usr/bin/env bash ++ ++# Copyright (C) 2025 Red Hat, Inc. All rights reserved. ++# ++# This copyrighted material is made available to anyone wishing to use, ++# modify, copy, or redistribute it subject to the terms and conditions ++# of the GNU General Public License v.2. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software Foundation, ++# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ ++# Test for classic snapshots of raid throwing warning/error on creation/activation ++ ++ ++. lib/inittest --skip-with-lvmpolld ++ ++aux have_raid 1 3 0 || skip ++ ++aux prepare_devs 2 50 ++ ++# Create Raid1LV and wait for initial sync to finish. ++vgcreate $SHARED $vg "$dev1" "$dev2" ++lvcreate -y --type raid1 -m1 -n $lv1 -L32M $vg ++aux wait_for_sync $vg $lv1 ++ ++# Create classic snapshot of Raid1LV and check for warning message. ++lvcreate -y -s -n snap -L12M $vg/$lv1 "$dev1" 2>&1 | grep 'WARNING: Loss of snapshot ' >/dev/null 2>&1 ++ ++# Disable all LVs and the first PV with the snapshot allocated on. ++vgchange -an $vg ++aux disable_dev "$dev1" ++ ++# Active vg and check for warning message. ++not vgchange -ay $vg 2>&1 | grep -E 'Activating raid LV .* requires the removal of partial snapshot' >/dev/null 2>&1 ++ ++# Remove the snapshot having lost its backing PV. ++lvremove -y $vg/snap ++ ++# Active vg and check for warning message not being displayed. ++vgchange -ay $vg 2>&1 | not grep -E 'Activating raid LV .* requires the removal of partial snapshot' >/dev/null 2>&1 ++ ++ls $DM_DEV_DIR/$vg/$lv1 ++ ++lvremove -y $vg/$lv1 ++vgremove -ff $vg +-- +2.51.1 + diff --git a/0051-WHATS_NEW-update.patch b/0051-WHATS_NEW-update.patch new file mode 100644 index 0000000..857e6fa --- /dev/null +++ b/0051-WHATS_NEW-update.patch @@ -0,0 +1,36 @@ +From 8af5d6dda5a1e29e0fa9e573ca6f6cf69d07aa9b Mon Sep 17 00:00:00 2001 +From: Heinz Mauelshagen +Date: Mon, 27 Oct 2025 19:15:06 +0100 +Subject: [PATCH 51/51] WHATS_NEW: update + +--- + WHATS_NEW | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 41fea1a7a..19442f8c5 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,8 +1,19 @@ ++Version 2.03.37 - ++================== ++ Warn on classic snapshot on raid creation and error on activation + test. ++ ++Version 2.03.35 - ++================== ++ Fix unlocking devices file only after all PVs are processed. ++ Avoid creating system.devices when deleting entries. ++ Fix --lockopt handling in lvmlockd when --nolocking is used. ++ + Version 2.03.34 - + ================== + Fix lvmdevices --deldev/--delpvid to error out if devices file not writeable. + Fix lvresize corruption in LV->crypt->FS stack if near crypt min size limit. + Fix autoactivation on top of loop dev PVs to trigger once for change uevents. ++ Add lvmlockd --lockopt repair to reinitialize corrupted sanlock leases. + + Version 2.03.33 - 27th June 2025 + ================================ +-- +2.51.1 + diff --git a/lvm2.spec b/lvm2.spec index 20af8c4..143042b 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -54,7 +54,7 @@ Version: 2.03.33 %if 0%{?from_snapshot} Release: 0.1.20211115git%{shortcommit}%{?dist}%{?rel_suffix} %else -Release: 1%{?dist}%{?rel_suffix} +Release: 2%{?dist}%{?rel_suffix} %endif License: GPL-2.0-only URL: https://sourceware.org/lvm2 @@ -110,6 +110,10 @@ Patch44: 0044-lvmdevices-do-not-create-system.devices-when-deletin.patch Patch45: 0045-tools-pvchange-unlock-devices-file-at-the-end-of-cmd.patch Patch46: 0046-tools-pvchange-unlock-devices-file-at-the-end-of-cmd.patch Patch47: 0047-make-generate.patch +Patch48: 0048-activating-raid-LV-with-partial-snapshot-is-an-error.patch +Patch49: 0049-lv_manip-show-a-warning-during-classic-snapshot-crea.patch +Patch50: 0050-test-add-new-test-for-snapshot-on-raid-creation-acti.patch +Patch51: 0051-WHATS_NEW-update.patch BuildRequires: make BuildRequires: gcc @@ -741,6 +745,9 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Mon Nov 10 2025 Marian Csontos - 2.03.33-2 +- Add message when activating RAID volumes with snapshots. + * Mon Sep 29 2025 Marian Csontos - 2.03.33-1 - Update to upstream version 2.03.33. - See WHATS_NEW and WHATS_NEW_DM for more information.