From e2fd3d1ba86f210fd7b44212bb594175a9ccdfc0 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Wed, 13 Nov 2024 11:02:47 +0100 Subject: [PATCH] Additional patches for 9.6.0 lvm2 Resolves: RHEL-8324 RHEL-66612 --- 0001-RHEL9.patch | 2 +- ...dm.rules-bump-DM_UDEV_RULES_VSN-to-3.patch | 2 +- ...ules-don-t-export-and-save-DM_NOSCAN.patch | 2 +- ...ules-don-t-export-and-save-DM_SUSPEN.patch | 2 +- ....rules-don-t-restore-DM_UDEV_DISABLE.patch | 2 +- ...es-don-t-restore-DM_UDEV_DISABLE_OTH.patch | 2 +- 0007-WHATS_NEW-update.patch | 2 +- ...ipe-count-and-size-validation-for-RA.patch | 104 ++++++++++++++++++ ...-same-param-validation-for-RAID-0-as.patch | 30 +++++ ...erfluous-a-option-for-df-used-in-lvr.patch | 31 ++++++ 0011-WHATS_NEW-update.patch | 26 +++++ ...-fix-input-units-for-minimim_io_size.patch | 59 ++++++++++ 0013-tests-check-vdo-minimum_io_size.patch | 33 ++++++ lvm2.spec | 15 ++- 14 files changed, 303 insertions(+), 9 deletions(-) create mode 100644 0008-lv_manip-fix-stripe-count-and-size-validation-for-RA.patch create mode 100644 0009-lv_manip-use-the-same-param-validation-for-RAID-0-as.patch create mode 100644 0010-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch create mode 100644 0011-WHATS_NEW-update.patch create mode 100644 0012-vdo-fix-input-units-for-minimim_io_size.patch create mode 100644 0013-tests-check-vdo-minimum_io_size.patch diff --git a/0001-RHEL9.patch b/0001-RHEL9.patch index 2f8726e..265c402 100644 --- a/0001-RHEL9.patch +++ b/0001-RHEL9.patch @@ -1,7 +1,7 @@ From 4ed40e67197778b28e4b822558614a517242e3e1 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 3 Oct 2024 16:14:11 +0200 -Subject: [PATCH 1/7] RHEL9 +Subject: [PATCH 01/13] RHEL9 --- VERSION | 2 +- diff --git a/0002-Revert-10-dm.rules-bump-DM_UDEV_RULES_VSN-to-3.patch b/0002-Revert-10-dm.rules-bump-DM_UDEV_RULES_VSN-to-3.patch index 627f36c..ad74ed9 100644 --- a/0002-Revert-10-dm.rules-bump-DM_UDEV_RULES_VSN-to-3.patch +++ b/0002-Revert-10-dm.rules-bump-DM_UDEV_RULES_VSN-to-3.patch @@ -1,7 +1,7 @@ From 290f2740efee0f9a3f6b9f84c277e0d4e81927db Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 16 May 2024 15:30:02 +0200 -Subject: [PATCH 2/7] Revert "10-dm.rules: bump DM_UDEV_RULES_VSN to 3" +Subject: [PATCH 02/13] Revert "10-dm.rules: bump DM_UDEV_RULES_VSN to 3" This reverts commit 038f9254d9554654197b59c160e3f775af27cdb1. --- diff --git a/0003-Revert-dm-udev-rules-don-t-export-and-save-DM_NOSCAN.patch b/0003-Revert-dm-udev-rules-don-t-export-and-save-DM_NOSCAN.patch index d2535af..cabb59b 100644 --- a/0003-Revert-dm-udev-rules-don-t-export-and-save-DM_NOSCAN.patch +++ b/0003-Revert-dm-udev-rules-don-t-export-and-save-DM_NOSCAN.patch @@ -1,7 +1,7 @@ From 57fa9b840028112e9e455c960dad5bd595625428 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 16 May 2024 15:30:15 +0200 -Subject: [PATCH 3/7] Revert "dm udev rules: don't export and save DM_NOSCAN" +Subject: [PATCH 03/13] Revert "dm udev rules: don't export and save DM_NOSCAN" This reverts commit a196752969320cfc34a97cc97afa1978fa57da73. --- diff --git a/0004-Revert-dm-udev-rules-don-t-export-and-save-DM_SUSPEN.patch b/0004-Revert-dm-udev-rules-don-t-export-and-save-DM_SUSPEN.patch index bd68949..f94cb2b 100644 --- a/0004-Revert-dm-udev-rules-don-t-export-and-save-DM_SUSPEN.patch +++ b/0004-Revert-dm-udev-rules-don-t-export-and-save-DM_SUSPEN.patch @@ -1,7 +1,7 @@ From 885113b30d7873ac671490715312431f706d26e8 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 16 May 2024 15:30:24 +0200 -Subject: [PATCH 4/7] Revert "dm udev rules: don't export and save +Subject: [PATCH 04/13] Revert "dm udev rules: don't export and save DM_SUSPENDED" This reverts commit 21ca92c4325b6b161fb1e1f10942ad9f8d23c144. diff --git a/0005-Revert-11-dm-lvm.rules-don-t-restore-DM_UDEV_DISABLE.patch b/0005-Revert-11-dm-lvm.rules-don-t-restore-DM_UDEV_DISABLE.patch index 10a7bfc..cde324e 100644 --- a/0005-Revert-11-dm-lvm.rules-don-t-restore-DM_UDEV_DISABLE.patch +++ b/0005-Revert-11-dm-lvm.rules-don-t-restore-DM_UDEV_DISABLE.patch @@ -1,7 +1,7 @@ From 89058bc0687baec653df87f14fd25da32577cc6d Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 16 May 2024 15:30:37 +0200 -Subject: [PATCH 5/7] Revert "11-dm-lvm.rules: don't restore +Subject: [PATCH 05/13] Revert "11-dm-lvm.rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db" This reverts commit 2b2f11a74cd5cc05f266fd0c65f0e55eb8bafd9f. diff --git a/0006-Revert-10-dm-rules-don-t-restore-DM_UDEV_DISABLE_OTH.patch b/0006-Revert-10-dm-rules-don-t-restore-DM_UDEV_DISABLE_OTH.patch index d6dbc47..9edf4a0 100644 --- a/0006-Revert-10-dm-rules-don-t-restore-DM_UDEV_DISABLE_OTH.patch +++ b/0006-Revert-10-dm-rules-don-t-restore-DM_UDEV_DISABLE_OTH.patch @@ -1,7 +1,7 @@ From cccc336a97ce85cf68ec7a80390c42dae243621b Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 16 May 2024 15:30:48 +0200 -Subject: [PATCH 6/7] Revert "10-dm-rules: don't restore +Subject: [PATCH 06/13] Revert "10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db" This reverts commit f98d020eadafe7d8db7bec1f5a26915615e5a6a9. diff --git a/0007-WHATS_NEW-update.patch b/0007-WHATS_NEW-update.patch index bc4dcfe..5f251c9 100644 --- a/0007-WHATS_NEW-update.patch +++ b/0007-WHATS_NEW-update.patch @@ -1,7 +1,7 @@ From e6f8d9855336dbf1cbf212f60b84a03946365795 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Thu, 16 May 2024 15:34:28 +0200 -Subject: [PATCH 7/7] WHATS_NEW: update +Subject: [PATCH 07/13] WHATS_NEW: update --- WHATS_NEW_DM | 7 +++++++ diff --git a/0008-lv_manip-fix-stripe-count-and-size-validation-for-RA.patch b/0008-lv_manip-fix-stripe-count-and-size-validation-for-RA.patch new file mode 100644 index 0000000..edc9c8f --- /dev/null +++ b/0008-lv_manip-fix-stripe-count-and-size-validation-for-RA.patch @@ -0,0 +1,104 @@ +From f2e8b49e1dd70f3735ff556f3f7296078a057a5e Mon Sep 17 00:00:00 2001 +From: Peter Rajnoha +Date: Tue, 5 Nov 2024 09:26:03 +0100 +Subject: [PATCH 08/13] lv_manip: fix stripe count and size validation for RAID + LVs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix stripe count and size parameter validation for RAID LVs and +include existing automatic setting of these parameters based +on current shape of the RAID LV in case these are not set +on command line fully. + +Previously, this was done only to a certain subset given by this +condition (where the 'stripes' is the '-i|--stripes' cmd line arg +and the 'stripe_size' is actually the '-I|--stripesize' cmd line arg): + + !(stripes == 1 || (stripes > 1 && stripe_size)) + +This condition is a bit harder to follow at first sight and there +are no comments around with explanation for why this one is used, +so let's analyze it a bit more. + +First, let's convert this to an equivalent condition (De Morgan law) +so it's easier to read for humans: + + stripes != 1 && !(stripes > 1 && stripe_size) + +Note: Both stripe and stripesize are unsigned integers, so they can't be negative. + +Now, based on that condition, we were running the code to deduce the +stripe/stripesize and do the checks ("the code") only if both of these +are true: + + - stripes is different from 1 + + - we don't have stripes > 1 and stripe_size defined at the same time + +But this is not correct in all cases, because: + + A) if someone uses stripes = 0, then "the code" is executed + (correct) + + B) if someone uses stripes = 1, then "the code" is not executed + (wrong: we still need to be able to check the args against + existing RAID LV stripes whether it matches) + + - if someone uses stripes > 1, then "the code" is: + + C) if stripe_size = 0, executed + (correct) + + D) if stripe_size > 0, not executed + (wrong: we still want to check against existing RAID LV stripes) + +Current issues with this condition: + The B) ends up with segfault. + + ❯ lvextend -i 1 -l+1 vg/lvol0 + Rounding size 4.00 MiB (1 extents) up to stripe boundary size 8.00 MiB (2 extents). + Segmentation fault (core dumped) + + The D) ends up with errors like: + + ❯ lvextend -i 3 -l+1 -I128k vg/lvol0 + Rounding size 4.00 MiB (1 extents) up to stripe boundary size 8.00 MiB (2 extents). + Rounding size (4 extents) up to stripe boundary size for segment (5 extents). + Size of logical volume vg/lvol0 changed from 8.00 MiB (2 extents) to 20.00 MiB (5 extents). + LV lvol0: segment 1 with len=5 has inconsistent area_len 3 + Couldn't read all logical volumes for volume group vg. + Failed to write VG vg. + +Conclusion: + The condition needs to be removed so we always run "the code" to check + given striping args given on command line against existing RAID LV + striping. The reason is that we don't want to allow changing stripe + count for RAID LVs through lvextend and we need to end up with the + error: + "Unable to extend segment type with different number of stripes" + + (We do support changing the striping by lvconvert's reshaping functionality only). + +(cherry picked from commit b5249fa3c20fe5d9e1d4811e7e5bfd957b15a820) +--- + lib/metadata/lv_manip.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index a1d4f641a..e14947357 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -5468,7 +5468,7 @@ static int _lvresize_adjust_extents(struct logical_volume *lv, + } else if (seg_is_raid0(seg_last)) { + lp->stripes = seg_last->area_count; + lp->stripe_size = seg_last->stripe_size; +- } else if (!(lp->stripes == 1 || (lp->stripes > 1 && lp->stripe_size))) { ++ } else { + /* If extending, find stripes, stripesize & size of last segment */ + /* FIXME Don't assume mirror seg will always be AREA_LV */ + /* FIXME We will need to support resize for metadata LV as well, +-- +2.47.0 + diff --git a/0009-lv_manip-use-the-same-param-validation-for-RAID-0-as.patch b/0009-lv_manip-use-the-same-param-validation-for-RAID-0-as.patch new file mode 100644 index 0000000..31d31cb --- /dev/null +++ b/0009-lv_manip-use-the-same-param-validation-for-RAID-0-as.patch @@ -0,0 +1,30 @@ +From 75d4056f39886b6cc3e6546dbb03bc7be1923990 Mon Sep 17 00:00:00 2001 +From: Peter Rajnoha +Date: Tue, 5 Nov 2024 14:48:23 +0100 +Subject: [PATCH 09/13] lv_manip: use the same param validation for RAID 0 as + for RAID 1/4/5/6 + +This actually reverts commit 83ae675f8df53010c984b78d0318d0d92d5ac83a. + +(cherry picked from commit 1d8a4c4817895f45a5fee00ccf721b351e5a4668) +--- + lib/metadata/lv_manip.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index e14947357..15a7f3c9a 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -5465,9 +5465,6 @@ static int _lvresize_adjust_extents(struct logical_volume *lv, + /* FIXME Warn if command line values are being overridden? */ + lp->stripes = seg_last->area_count / seg_mirrors; + lp->stripe_size = seg_last->stripe_size; +- } else if (seg_is_raid0(seg_last)) { +- lp->stripes = seg_last->area_count; +- lp->stripe_size = seg_last->stripe_size; + } else { + /* If extending, find stripes, stripesize & size of last segment */ + /* FIXME Don't assume mirror seg will always be AREA_LV */ +-- +2.47.0 + diff --git a/0010-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch b/0010-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch new file mode 100644 index 0000000..f75a204 --- /dev/null +++ b/0010-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch @@ -0,0 +1,31 @@ +From 66aa04c39c00e1b32ad0dfb85910afeaf8b5e88d Mon Sep 17 00:00:00 2001 +From: Peter Rajnoha +Date: Tue, 5 Nov 2024 14:20:59 +0100 +Subject: [PATCH 10/13] tests: remove superfluous -a option for df used in + lvresize-xfs.sh + +The df -a looks at whole system and it returns an error code in case +there's an inaccessible fs which is not even part of the testing environment. +The -a for df is not actually needed here in the lvresize-xfs test, so remove it. + +(cherry picked from commit a2ca20dad98f4d7389d449672b3ff0b16858f02b) +--- + test/shell/lvresize-xfs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/shell/lvresize-xfs.sh b/test/shell/lvresize-xfs.sh +index da204dac6..87fbf6f9d 100644 +--- a/test/shell/lvresize-xfs.sh ++++ b/test/shell/lvresize-xfs.sh +@@ -113,7 +113,7 @@ dd if=/dev/zero of="$mount_dir_space/zeros1" bs=1M count=20 oflag=direct + # succeeds, then the xfs extend fails because it cannot be done unmounted + not lvextend --fs resize --fsmode offline -L+20M $vg/$lv + check lv_field $vg/$lv lv_size "320.00m" +-df -a | tee dfa ++df | tee dfa + grep "$mount_dir_space" dfa + df --output=size "$mount_dir_space" |tee df2 + # fs not extended so fs size not changed +-- +2.47.0 + diff --git a/0011-WHATS_NEW-update.patch b/0011-WHATS_NEW-update.patch new file mode 100644 index 0000000..5c7ccc2 --- /dev/null +++ b/0011-WHATS_NEW-update.patch @@ -0,0 +1,26 @@ +From 06dae73111fb4b2d5ce22ab566fb60b0e1d3b7b3 Mon Sep 17 00:00:00 2001 +From: Peter Rajnoha +Date: Wed, 6 Nov 2024 10:39:27 +0100 +Subject: [PATCH 11/13] WHATS_NEW: update + +(cherry picked from commit 44a04b71f8e8ff730b5538c4b6323041cf904ece) +--- + WHATS_NEW | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 85ffe0d0c..d07a1eaeb 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,3 +1,8 @@ ++Version 2.03.29 - ++================== ++ Fix segfault/VG write error for raid LV lvextend -i|--stripes -I|--stripesize. ++ Revert ignore -i|--stripes, -I|--stripesize for lvextend on raid0 LV (2.03.27). ++ + Version 2.03.28 - 04th November 2024 + ==================================== + Use radix_tree to lookup for UUID within committed metadata. +-- +2.47.0 + diff --git a/0012-vdo-fix-input-units-for-minimim_io_size.patch b/0012-vdo-fix-input-units-for-minimim_io_size.patch new file mode 100644 index 0000000..3097459 --- /dev/null +++ b/0012-vdo-fix-input-units-for-minimim_io_size.patch @@ -0,0 +1,59 @@ +From 55bfaca8a87372887d401aaae7b5804b4f5ed826 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 8 Nov 2024 16:12:30 +0100 +Subject: [PATCH 12/13] vdo: fix input units for minimim_io_size + +When specifying minimum_io_size with --vdosettings, +command assumed wrong unit (sectors). + +So '--vdosettings minimum_io_size=512|4096' resulted into +an error that only 512 or 4096 values are allowed, but +at the same time values 1 or 8 were accepted. + +So fix by converting any number >= 512 to 'sectors' and +keep input of 1 or 8 still valid if anyone has been using +this before. + +So now we take 512 or 4096 and still also 1 or 8 with the +same effect. + +Also correct the 'error' message when invalid minimum_io_size +is specified. + +(cherry picked from commit 158d3243b638f50f62c60128168c21840787f1ab) +--- + device_mapper/vdo/vdo_target.c | 2 +- + tools/toollib.c | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/device_mapper/vdo/vdo_target.c b/device_mapper/vdo/vdo_target.c +index a8a753e39..cdd3dbe6d 100644 +--- a/device_mapper/vdo/vdo_target.c ++++ b/device_mapper/vdo/vdo_target.c +@@ -28,7 +28,7 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp, + if ((vtp->minimum_io_size != (512 >> SECTOR_SHIFT)) && + (vtp->minimum_io_size != (4096 >> SECTOR_SHIFT))) { + log_error("VDO minimum io size %u is unsupported [512, 4096].", +- vtp->minimum_io_size); ++ (vtp->minimum_io_size << SECTOR_SHIFT)); + valid = false; + } + +diff --git a/tools/toollib.c b/tools/toollib.c +index dcb6c8f4f..f854d17c5 100644 +--- a/tools/toollib.c ++++ b/tools/toollib.c +@@ -1372,6 +1372,10 @@ int get_vdo_settings(struct cmd_context *cmd, + u |= VDO_CHANGE_ONLINE; + } + ++ /* store size in sector units */ ++ if (vtp->minimum_io_size >= 512) ++ vtp->minimum_io_size >>= SECTOR_SHIFT; ++ + // validation of updated VDO option + if (!dm_vdo_validate_target_params(vtp, 0 /* vdo_size */)) + goto_out; +-- +2.47.0 + diff --git a/0013-tests-check-vdo-minimum_io_size.patch b/0013-tests-check-vdo-minimum_io_size.patch new file mode 100644 index 0000000..a0b7d4d --- /dev/null +++ b/0013-tests-check-vdo-minimum_io_size.patch @@ -0,0 +1,33 @@ +From aa78a84b20861bb37ca420c1278967f42e6c24dc Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 8 Nov 2024 16:38:29 +0100 +Subject: [PATCH 13/13] tests: check vdo minimum_io_size + +(cherry picked from commit dcac774f0982470b29bf04f27b6394fe27c4df71) +--- + test/shell/lvcreate-vdo.sh | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/test/shell/lvcreate-vdo.sh b/test/shell/lvcreate-vdo.sh +index b24801375..87d6f98a1 100644 +--- a/test/shell/lvcreate-vdo.sh ++++ b/test/shell/lvcreate-vdo.sh +@@ -89,4 +89,15 @@ check lv_field $vg/$lv1 vdo_ack_threads "4" + lvs -a $vg + lvremove -ff $vg + ++lvcreate --type vdo --vdosettings 'minimum_io_size=512' -L10G -V1T -ky -n $lv1 $vg ++check lv_field $vg/$lv1 vdo_minimum_io_size "512b" ++lvremove -ff $vg ++ ++lvcreate --type vdo --vdosettings 'minimum_io_size=4096' -L10G -V1T -ky -n $lv1 $vg ++check lv_field $vg/$lv1 vdo_minimum_io_size "4.00k" ++lvremove -ff $vg ++ ++# only 512 or 4096 are valid values (and eventually 1 or 8 sectors) ++not lvcreate --type vdo --vdosettings 'minimum_io_size=8000' -L10G -V1T -ky -n $lv1 $vg ++ + vgremove -ff $vg +-- +2.47.0 + diff --git a/lvm2.spec b/lvm2.spec index a2fe863..cde16c5 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -54,7 +54,7 @@ Version: 2.03.28 %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 @@ -70,6 +70,12 @@ Patch4: 0004-Revert-dm-udev-rules-don-t-export-and-save-DM_SUSPEN.patch Patch5: 0005-Revert-11-dm-lvm.rules-don-t-restore-DM_UDEV_DISABLE.patch Patch6: 0006-Revert-10-dm-rules-don-t-restore-DM_UDEV_DISABLE_OTH.patch Patch7: 0007-WHATS_NEW-update.patch +Patch8: 0008-lv_manip-fix-stripe-count-and-size-validation-for-RA.patch +Patch9: 0009-lv_manip-use-the-same-param-validation-for-RAID-0-as.patch +Patch10: 0010-tests-remove-superfluous-a-option-for-df-used-in-lvr.patch +Patch11: 0011-WHATS_NEW-update.patch +Patch12: 0012-vdo-fix-input-units-for-minimim_io_size.patch +Patch13: 0013-tests-check-vdo-minimum_io_size.patch BuildRequires: make BuildRequires: gcc @@ -687,7 +693,7 @@ the device-mapper event library. %package testsuite Summary: LVM2 Testsuite # Most of the code is GPL-2.0-only, the harness in test/lib/{brick-shelltest.h,runner.cpp} is BSD, and C files in test/api are LGPL-2.1-only... -License: LGPL-2.1-only and GPL-2.0-only and BSD-2-Clause +License: LGPL-2.1-only AND GPL-2.0-only AND BSD-2-Clause %description testsuite An extensive functional testsuite for LVM2. @@ -700,6 +706,11 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Wed Nov 13 2024 Marian Csontos - 2.03.28-2 +- Fix SPDX License identifiers. +- Fix input units for VDO LV's minimim_io_size. +- Fix stripe count and validation for RAID LVs. + * Tue Nov 05 2024 Marian Csontos - 2.03.28-1 - Update to upstream version 2.03.28. - See WHATS_NEW and WHATS_NEW_DM for more information.