From 57d7cdb935f5e18fb7246fe92815341ff87915ae Mon Sep 17 00:00:00 2001 From: wguanghao Date: Sat, 20 Feb 2021 16:28:20 +0800 Subject: [PATCH 1/2] sync bugfix patches from community --- ...reject-size-change-on-2-legged-raid5.patch | 41 ++++++++++++++++ 0014-also-check-for-2-legged-raid4.patch | 28 +++++++++++ ...ve-estimation-of-sufficient_pes_free.patch | 47 +++++++++++++++++++ ...ame-fix-error-value-when-name-exists.patch | 24 ++++++++++ lvm2.spec | 9 +++- 5 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 0013-reject-size-change-on-2-legged-raid5.patch create mode 100644 0014-also-check-for-2-legged-raid4.patch create mode 100644 0015-alloc-improve-estimation-of-sufficient_pes_free.patch create mode 100644 0016-vgrename-fix-error-value-when-name-exists.patch diff --git a/0013-reject-size-change-on-2-legged-raid5.patch b/0013-reject-size-change-on-2-legged-raid5.patch new file mode 100644 index 0000000..c4728e8 --- /dev/null +++ b/0013-reject-size-change-on-2-legged-raid5.patch @@ -0,0 +1,41 @@ +From 2cf0f90780bed64cb4062eb6dfa714ed03eecfb7 Mon Sep 17 00:00:00 2001 +From: Heinz Mauelshagen +Date: Wed, 24 Jun 2020 13:52:53 +0200 +Subject: [PATCH] lv{resize,extend,reduce}: reject size change on 2-legged + raid5* + +Reject size changing request in to avoid 'Bus error' and +display hint to convert to more stripes. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1784351 +--- + lib/metadata/lv_manip.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index c1c86aa4c..142435bbb 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -5066,6 +5066,7 @@ static int _lvresize_check(struct logical_volume *lv, + struct lvresize_params *lp) + { + struct volume_group *vg = lv->vg; ++ struct lv_segment *seg = first_seg(lv); + + if (lv_is_external_origin(lv)) { + /* +@@ -5089,6 +5090,12 @@ static int _lvresize_check(struct logical_volume *lv, + return 0; + } + ++ if (seg && seg_is_any_raid5(seg) && seg->area_count < 3) { ++ log_error("Cannot resize %s LV %s. Convert to more stripes first.", ++ lvseg_name(seg), display_lvname(lv)); ++ return 0; ++ } ++ + if (lv_is_raid(lv) && + lp->resize == LV_REDUCE) { + unsigned attrs; +-- +2.18.4 \ No newline at end of file diff --git a/0014-also-check-for-2-legged-raid4.patch b/0014-also-check-for-2-legged-raid4.patch new file mode 100644 index 0000000..555d5b3 --- /dev/null +++ b/0014-also-check-for-2-legged-raid4.patch @@ -0,0 +1,28 @@ +From 04bba5ea421b02275197bfb16b4d1bbf8879b240 Mon Sep 17 00:00:00 2001 +From: Heinz Mauelshagen +Date: Wed, 24 Jun 2020 14:02:29 +0200 +Subject: [PATCH] lv{resize,extend,reduce}: also check for 2-legged raid4 + +Users can also convert 2-legged raid1 to raid4 thus causing 'Bus error' +on resize requests. + +Related: https://bugzilla.redhat.com/show_bug.cgi?id=1784351 +--- + 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 142435bbb..1642b90a0 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -5090,7 +5090,7 @@ static int _lvresize_check(struct logical_volume *lv, + return 0; + } + +- if (seg && seg_is_any_raid5(seg) && seg->area_count < 3) { ++ if (seg && (seg_is_raid4(seg) || seg_is_any_raid5(seg)) && seg->area_count < 3) { + log_error("Cannot resize %s LV %s. Convert to more stripes first.", + lvseg_name(seg), display_lvname(lv)); + return 0; +-- +2.18.4 \ No newline at end of file diff --git a/0015-alloc-improve-estimation-of-sufficient_pes_free.patch b/0015-alloc-improve-estimation-of-sufficient_pes_free.patch new file mode 100644 index 0000000..0123a2c --- /dev/null +++ b/0015-alloc-improve-estimation-of-sufficient_pes_free.patch @@ -0,0 +1,47 @@ +From 38b33a3b6b15693e7a9ce994f7819db1bf28fc4c Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 11 Sep 2020 20:57:20 +0200 +Subject: [PATCH] alloc: improve estimation of sufficient_pes_free + +Metadata size was calculated correctly only for raids. + +Fixes problem for crash during lvcreate when thin-pool was created +on a VG where remaining free space had the size to only fit a single +metadata LV and not also its _pmspare. + +Lvcreate crashed with this assert message: + +lvcreate: metadata/pv_map.c:198: consume_pv_area: Assertion `to_go <= pva->count' failed. +Aborted (core dumped) + +TODO: there is probably to large overload of several alloc_handle +variables. + +Reported-by: Wu Guanghao +Reported-by: Zhiqiang Liu +--- + lib/metadata/lv_manip.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index 0b1fdce..2d5778b 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -1698,12 +1698,12 @@ static int _sufficient_pes_free(struct alloc_handle *ah, struct dm_list *pvms, + { + uint32_t area_extents_needed = (extents_still_needed - allocated) * ah->area_count / ah->area_multiple; + uint32_t parity_extents_needed = (extents_still_needed - allocated) * ah->parity_count / ah->area_multiple; +- uint32_t metadata_extents_needed = ah->alloc_and_split_meta ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN; /* One each */ +- uint32_t total_extents_needed = area_extents_needed + parity_extents_needed + metadata_extents_needed; ++ uint32_t metadata_extents_needed = ah->alloc_and_split_meta ? 0 : ah->metadata_area_count * RAID_METADATA_AREA_LEN + ah->log_len; /* One each */ ++ uint64_t total_extents_needed = (uint64_t)area_extents_needed + parity_extents_needed + metadata_extents_needed; + uint32_t free_pes = pv_maps_size(pvms); + + if (total_extents_needed > free_pes) { +- log_error("Insufficient free space: %" PRIu32 " extents needed," ++ log_error("Insufficient free space: %" PRIu64 " extents needed," + " but only %" PRIu32 " available", + total_extents_needed, free_pes); + return 0; +-- +2.23.0 \ No newline at end of file diff --git a/0016-vgrename-fix-error-value-when-name-exists.patch b/0016-vgrename-fix-error-value-when-name-exists.patch new file mode 100644 index 0000000..61709bd --- /dev/null +++ b/0016-vgrename-fix-error-value-when-name-exists.patch @@ -0,0 +1,24 @@ +From 19071ff2ecbb5900aa4be0e1baf3f8efe7df1456 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Tue, 21 Apr 2020 09:33:56 -0500 +Subject: [PATCH] vgrename: fix error value when name exists + +--- + tools/vgrename.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/vgrename.c b/tools/vgrename.c +index 2ece9f3..04e65ad 100644 +--- a/tools/vgrename.c ++++ b/tools/vgrename.c +@@ -189,7 +189,7 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv) + vg_name_new = skip_dev_dir(cmd, argv[1], NULL); + + if (!validate_vg_rename_params(cmd, vg_name_old, vg_name_new)) +- return_0; ++ return_ECMD_FAILED; + + if (!(vp.vg_name_old = dm_pool_strdup(cmd->mem, vg_name_old))) + return_ECMD_FAILED; +-- +2.23.0 \ No newline at end of file diff --git a/lvm2.spec b/lvm2.spec index 14e5350..7972838 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.09 -Release: 5 +Release: 6 Epoch: 8 Summary: Tools for logical volume management License: GPLv2 and LGPLv2 @@ -61,6 +61,10 @@ Patch9: 0009-enhancement-add-dfx-log.patch Patch10: 0010-enhancement-syslog-more-when-use-libdevmapper-so.patch Patch11: 0011-enhancement-log-it-when-disk-slow.patch Patch12: 0012-bugfix-lvm2-fix-the-reuse-of-va_list.patch +Patch13: 0013-reject-size-change-on-2-legged-raid5.patch +Patch14: 0014-also-check-for-2-legged-raid4.patch +Patch15: 0015-alloc-improve-estimation-of-sufficient_pes_free.patch +Patch16: 0016-vgrename-fix-error-value-when-name-exists.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -484,6 +488,9 @@ fi %changelog +* Fri Feb 19 2021 wuguanghao - 8:2.03.09-6 +- sync bugfix from community + * Thu Nov 12 2020 wuguanghao - 8.2.03.09-5 - add epoch to the version of help package required -- Gitee From 6c5a51323e3adb021d8283cb78149c3dec120255 Mon Sep 17 00:00:00 2001 From: wguanghao Date: Thu, 29 Apr 2021 19:30:46 +0800 Subject: [PATCH 2/2] revert commit of fix VERSION issue when packaging --- lvm2.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lvm2.spec b/lvm2.spec index 7972838..5e6ff22 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -43,7 +43,7 @@ Name: lvm2 Version: 2.03.09 -Release: 6 +Release: 7 Epoch: 8 Summary: Tools for logical volume management License: GPLv2 and LGPLv2 @@ -488,6 +488,9 @@ fi %changelog +* Thu Apr 28 2021 wuguanghao - 8:2.03.09-7 +- revert commit of fix VERSION issue when packaging + * Fri Feb 19 2021 wuguanghao - 8:2.03.09-6 - sync bugfix from community -- Gitee