From 16deb6f9e039b8db749cc9fcf006894c889766d6 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 12 2021 04:20:28 +0000 Subject: import lvm2-2.03.12-6.el8 --- diff --git a/SOURCES/lvm2-2_03_13-test.patch b/SOURCES/lvm2-2_03_13-test.patch new file mode 100644 index 0000000..f6672b7 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-test.patch @@ -0,0 +1,61 @@ + test/shell/vgsplit-cache.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 47 insertions(+) + +diff --git a/test/shell/vgsplit-cache.sh b/test/shell/vgsplit-cache.sh +index eba85be..202e4b5 100644 +--- a/test/shell/vgsplit-cache.sh ++++ b/test/shell/vgsplit-cache.sh +@@ -75,6 +75,53 @@ lvremove -y $vg + vgremove -ff $vg + vgremove -ff $vg1 + ++# ++# Check we handle pmspare for splitted VGs ++# ++aux prepare_vg 7 ++ ++# Create cache-pool and pmspare on single PV1 ++lvcreate -L10 --type cache-pool $vg/cpool "$dev1" ++# Move spare to separate PV3 ++pvmove -n $vg/lvol0_pmspare "$dev1" "$dev3" ++# Create origin on PV2 ++lvcreate -L10 -n orig $vg "$dev2" ++lvconvert -H -y --cachepool $vg/cpool $vg/orig ++ ++vgchange -an $vg ++ ++# Check we do not create new _pmspare ++vgsplit --poolmetadataspare n $vg $vg1 "$dev2" "$dev1" ++ ++check lv_exists $vg/lvol0_pmspare ++check lv_not_exists $vg1/lvol0_pmspare ++ ++vgremove $vg ++vgremove -f $vg1 ++ ++ ++aux prepare_vg 7 ++ ++# Again - now with handling _pmspare by vgsplit ++lvcreate -L10 --type cache-pool $vg/cpool "$dev1" ++# Move spare to separate PV3 ++pvmove -n $vg/lvol0_pmspare "$dev1" "$dev3" ++# Create origin on PV2 ++lvcreate -L10 -n orig $vg "$dev2" ++lvconvert -H -y --cachepool $vg/cpool $vg/orig ++ ++vgchange -an $vg ++ ++# Handle _pmspare (default) ++vgsplit --poolmetadataspare y $vg $vg1 "$dev2" "$dev1" ++ ++check lv_not_exists $vg/lvol0_pmspare ++check lv_exists $vg1/lvol0_pmspare ++ ++vgremove $vg ++vgremove -f $vg1 ++ ++ + vgcreate $vg "$dev1" "$dev2" "$dev3" "$dev4" + + lvcreate -L6 -n $lv1 -an $vg "$dev2" diff --git a/SOURCES/lvm2-2_03_13-tests-extend-vgmerge-testing.patch b/SOURCES/lvm2-2_03_13-tests-extend-vgmerge-testing.patch new file mode 100644 index 0000000..22dca89 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-tests-extend-vgmerge-testing.patch @@ -0,0 +1,53 @@ + test/shell/vgmerge-operation.sh | 42 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/test/shell/vgmerge-operation.sh b/test/shell/vgmerge-operation.sh +index 21889e9..0bf517d 100644 +--- a/test/shell/vgmerge-operation.sh ++++ b/test/shell/vgmerge-operation.sh +@@ -80,3 +80,45 @@ grep "Duplicate logical volume name \"$lv1\" in \"$vg2\" and \"$vg1" err + check pvlv_counts $vg1 2 1 0 + check pvlv_counts $vg2 2 1 0 + vgremove -f $vg1 $vg2 ++ ++ ++# 'vgmerge' handle pmspare for merged VG ++if aux have_thin 1 5 0; then ++ ++# With disabled pmspare nothing is created ++vgcreate $vg1 "$dev1" "$dev2" ++vgcreate $vg2 "$dev3" "$dev4" ++lvcreate -T -L8M $vg1/pool1 --poolmetadatasize 8M --poolmetadataspare n ++lvcreate -T -L8M $vg2/pool2 --poolmetadatasize 4M --poolmetadataspare n ++vgchange -an $vg1 $vg2 ++ ++vgmerge --poolmetadataspare n $vg1 $vg2 ++check lv_not_exists $vg/lvol0_pmspare ++vgremove -ff $vg1 ++ ++ ++# With pmspare handling there are one created ++vgcreate $vg1 "$dev1" "$dev2" ++vgcreate $vg2 "$dev3" "$dev4" ++lvcreate -T -L8M $vg1/pool1 --poolmetadatasize 8M --poolmetadataspare n ++lvcreate -T -L8M $vg2/pool2 --poolmetadatasize 4M --poolmetadataspare n ++vgchange -an $vg1 $vg2 ++ ++vgmerge $vg1 $vg2 ++check lv_field $vg1/lvol0_pmspare size "8.00m" ++vgremove -ff $vg1 ++ ++ ++# When merged, bigger pmspare is preserved ++vgcreate $vg1 "$dev1" "$dev2" ++vgcreate $vg2 "$dev3" "$dev4" ++lvcreate -T -L8M $vg1/pool1 --poolmetadatasize 8M ++lvcreate -T -L8M $vg2/pool2 --poolmetadatasize 4M ++vgchange -an $vg1 $vg2 ++ ++vgmerge $vg1 $vg2 ++ ++check lv_field $vg1/lvol0_pmspare size "8.00m" ++vgremove -ff $vg1 ++ ++fi diff --git a/SOURCES/lvm2-2_03_13-thin-fix-component-detection-of-external-origin.patch b/SOURCES/lvm2-2_03_13-thin-fix-component-detection-of-external-origin.patch new file mode 100644 index 0000000..5b97d90 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-thin-fix-component-detection-of-external-origin.patch @@ -0,0 +1,63 @@ + WHATS_NEW | 1 + + lib/activate/activate.c | 5 ++++- + test/shell/lvconvert-cache-thin.sh | 22 ++++++++++++++++++++++ + 3 files changed, 27 insertions(+), 1 deletion(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 5806ecb..097160e 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.03.13 - + =============================== ++ Fix detection of active components of external origin volume. + Add vdoimport tool to support conversion of VDO volumes. + Support configurable allocation/vdo_pool_header_size. + Fix handling of lvconvert --type vdo-pool --virtualsize. +diff --git a/lib/activate/activate.c b/lib/activate/activate.c +index 6bda738..94fc944 100644 +--- a/lib/activate/activate.c ++++ b/lib/activate/activate.c +@@ -2740,7 +2740,10 @@ static int _component_cb(struct logical_volume *lv, void *data) + (lv_is_thin_pool(lv) && pool_is_active(lv))) + return -1; + +- if (lv_is_active(lv)) { ++ /* External origin is activated through thinLV and uses -real suffix. ++ * Note: for old clustered logic we would need to check for all thins */ ++ if ((lv_is_external_origin(lv) && lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0)) || ++ lv_is_active(lv)) { + if (!lv_is_component(lv) || lv_is_visible(lv)) + return -1; /* skip whole subtree */ + +diff --git a/test/shell/lvconvert-cache-thin.sh b/test/shell/lvconvert-cache-thin.sh +index 7dda6e6..9254239 100644 +--- a/test/shell/lvconvert-cache-thin.sh ++++ b/test/shell/lvconvert-cache-thin.sh +@@ -67,4 +67,26 @@ fail lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $vg/$lv + # Thin-pool CAN use cached data LV + lvconvert --yes --thinpool $vg/$lv + ++lvremove -f $vg ++ ++# Check we can active snapshot of cached external origin (BZ: 1967744) ++lvcreate -T -L10M $vg/pool "$dev1" ++ ++lvcreate -L10M -n origin $vg "$dev1" ++lvcreate -H -L4M -n CPOOL $vg/origin "$dev2" ++ ++# Use cached origin as external origin ++lvconvert -y -T --thinpool $vg/pool --originname extorig origin ++ ++# Check we can easily create snapshot of such LV ++lvcreate -y -kn -n snap -s $vg/origin ++ ++# Deactivate everything and do a component activation of _cmeta volume ++lvchange -an $vg ++lvchange -ay -y $vg/CPOOL_cpool_cmeta ++ ++# Now this must fail since component volume is active ++not lvcreate -y -kn -n snap2 -s $vg/origin |& tee err ++grep "cmeta is active" err ++ + vgremove -f $vg diff --git a/SOURCES/lvm2-2_03_13-vgmerge-remove-one-of-merge-pmspare-LVs.patch b/SOURCES/lvm2-2_03_13-vgmerge-remove-one-of-merge-pmspare-LVs.patch new file mode 100644 index 0000000..62d6686 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-vgmerge-remove-one-of-merge-pmspare-LVs.patch @@ -0,0 +1,28 @@ + tools/vgmerge.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/tools/vgmerge.c b/tools/vgmerge.c +index 895018a..884ad4b 100644 +--- a/tools/vgmerge.c ++++ b/tools/vgmerge.c +@@ -92,6 +92,20 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to, + } + } + ++ if (vg_from->pool_metadata_spare_lv && ++ vg_to->pool_metadata_spare_lv) { ++ if (vg_from->pool_metadata_spare_lv->le_count > ++ vg_to->pool_metadata_spare_lv->le_count) ++ /* Preserve bigger pmspare from VG_FROM */ ++ lv = vg_to->pool_metadata_spare_lv; ++ else ++ lv = vg_from->pool_metadata_spare_lv; ++ ++ log_debug_metadata("Removing pool metadata spare %s.", display_lvname(lv)); ++ if (!lv_remove_single(cmd, lv, DONT_PROMPT, 0)) ++ return_ECMD_FAILED; ++ } ++ + if (!vgs_are_compatible(cmd, vg_from, vg_to)) + goto_bad; + diff --git a/SOURCES/lvm2-2_03_13-vgmerge-support-option-poolmetadataspare.patch b/SOURCES/lvm2-2_03_13-vgmerge-support-option-poolmetadataspare.patch new file mode 100644 index 0000000..002c060 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-vgmerge-support-option-poolmetadataspare.patch @@ -0,0 +1,82 @@ + WHATS_NEW | 2 +- + man/vgmerge.8_pregen | 9 +++++++++ + tools/command-lines.in | 2 +- + tools/vgmerge.c | 6 ++++++ + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 0b8e3f2..5556789 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,6 +1,6 @@ + Version 2.03.13 - + =============================== +- Support --poolmetadataspare with vgsplit. ++ Support --poolmetadataspare with vgsplit and vgmerge. + Fix detection of active components of external origin volume. + Add vdoimport tool to support conversion of VDO volumes. + Support configurable allocation/vdo_pool_header_size. +diff --git a/man/vgmerge.8_pregen b/man/vgmerge.8_pregen +index 1264bb5..e229218 100644 +--- a/man/vgmerge.8_pregen ++++ b/man/vgmerge.8_pregen +@@ -27,6 +27,8 @@ of both VGs fit into the destination VG's limits. + .br + [ \fB-l\fP|\fB--list\fP ] + .br ++[ \fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ] ++.br + [ COMMON_OPTIONS ] + .ad b + .RE +@@ -147,6 +149,13 @@ Display long help text. + Disable locking. + . + .HP ++\fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ++.br ++Enable or disable the automatic creation and management of a ++spare pool metadata LV in the VG. A spare metadata LV is reserved ++space that can be used when repairing a pool. ++. ++.HP + \fB--profile\fP \fIString\fP + .br + An alias for --commandprofile or --metadataprofile, depending +diff --git a/tools/command-lines.in b/tools/command-lines.in +index a4785b3..0bc5a49 100644 +--- a/tools/command-lines.in ++++ b/tools/command-lines.in +@@ -1847,7 +1847,7 @@ DESC: Add devices from all accessible VGs to the devices file. + --- + + vgmerge VG VG +-OO: --autobackup Bool, --list ++OO: --autobackup Bool, --list, --poolmetadataspare Bool + ID: vgmerge_general + + --- +diff --git a/tools/vgmerge.c b/tools/vgmerge.c +index 884ad4b..08615cd 100644 +--- a/tools/vgmerge.c ++++ b/tools/vgmerge.c +@@ -64,6 +64,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to, + struct lv_list *lvl1, *lvl2; + int r = ECMD_FAILED; + int lock_vg_from_first = 0; ++ struct logical_volume *lv; ++ int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE); + + if (!strcmp(vg_name_to, vg_name_from)) { + log_error("Duplicate volume group name \"%s\"", vg_name_from); +@@ -185,6 +187,10 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to, + /* Flag up that some PVs have moved from another VG */ + vg_to->old_name = vg_from->name; + ++ /* Check whether size of pmspare is big enough now for merged VG */ ++ if (!handle_pool_metadata_spare(vg_to, 0, &vg_to->pvs, poolmetadataspare)) ++ goto_bad; ++ + /* store it on disks */ + log_verbose("Writing out updated volume group"); + if (!vg_write(vg_to) || !vg_commit(vg_to)) diff --git a/SOURCES/lvm2-2_03_13-vgremove-remove-forgotten-pmspare.patch b/SOURCES/lvm2-2_03_13-vgremove-remove-forgotten-pmspare.patch new file mode 100644 index 0000000..53fa667 --- /dev/null +++ b/SOURCES/lvm2-2_03_13-vgremove-remove-forgotten-pmspare.patch @@ -0,0 +1,18 @@ + tools/vgremove.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tools/vgremove.c b/tools/vgremove.c +index 8f73297..b6685ae 100644 +--- a/tools/vgremove.c ++++ b/tools/vgremove.c +@@ -65,6 +65,10 @@ static int _vgremove_single(struct cmd_context *cmd, const char *vg_name, + } + } + ++ if (vg->pool_metadata_spare_lv && ++ !lvremove_single(cmd, vg->pool_metadata_spare_lv, &void_handle)) ++ return_ECMD_FAILED; ++ + if (!lockd_free_vg_before(cmd, vg, 0)) + return_ECMD_FAILED; + diff --git a/SOURCES/lvm2-2_03_13-vgsplit-add-support-for-option-poolmetadataspare.patch b/SOURCES/lvm2-2_03_13-vgsplit-add-support-for-option-poolmetadataspare.patch new file mode 100644 index 0000000..1a9d26b --- /dev/null +++ b/SOURCES/lvm2-2_03_13-vgsplit-add-support-for-option-poolmetadataspare.patch @@ -0,0 +1,106 @@ + WHATS_NEW | 1 + + lib/metadata/pool_manip.c | 11 +++++++++++ + man/vgsplit.8_pregen | 9 +++++++++ + tools/command-lines.in | 2 +- + tools/vgsplit.c | 8 ++++++++ + 5 files changed, 30 insertions(+), 1 deletion(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 097160e..0b8e3f2 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.03.13 - + =============================== ++ Support --poolmetadataspare with vgsplit. + Fix detection of active components of external origin volume. + Add vdoimport tool to support conversion of VDO volumes. + Support configurable allocation/vdo_pool_header_size. +diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c +index 9ceec3a..e451e92 100644 +--- a/lib/metadata/pool_manip.c ++++ b/lib/metadata/pool_manip.c +@@ -722,6 +722,17 @@ int handle_pool_metadata_spare(struct volume_group *vg, uint32_t extents, + return 1; + } + ++ if (!extents) { ++ /* pmspare is not needed */ ++ if (lv) { ++ log_debug_metadata("Dropping unused pool metadata spare LV %s.", ++ display_lvname(lv)); ++ if (!lv_remove_single(vg->cmd, lv, DONT_PROMPT, 0)) ++ return_0; ++ } ++ return 1; ++ } ++ + if (extents > MAX_SIZE) + extents = MAX_SIZE; + +diff --git a/man/vgsplit.8_pregen b/man/vgsplit.8_pregen +index 331c6e4..8a0ae59 100644 +--- a/man/vgsplit.8_pregen ++++ b/man/vgsplit.8_pregen +@@ -70,6 +70,8 @@ Common options for command: + .hy + ] + .br ++[ \fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ] ++.br + [ \fB--\fP[\fBvg\fP]\fBmetadatacopies\fP \fBall\fP|\fBunmanaged\fP|\fINumber\fP ] + .ad b + .RE +@@ -235,6 +237,13 @@ Move only PVs used by the named LV. + Disable locking. + . + .HP ++\fB--poolmetadataspare\fP \fBy\fP|\fBn\fP ++.br ++Enable or disable the automatic creation and management of a ++spare pool metadata LV in the VG. A spare metadata LV is reserved ++space that can be used when repairing a pool. ++. ++.HP + \fB--profile\fP \fIString\fP + .br + An alias for --commandprofile or --metadataprofile, depending +diff --git a/tools/command-lines.in b/tools/command-lines.in +index 8607305..a4785b3 100644 +--- a/tools/command-lines.in ++++ b/tools/command-lines.in +@@ -1912,7 +1912,7 @@ ID: vgscan_general + + --- + +-OO_VGSPLIT: --autobackup Bool ++OO_VGSPLIT: --autobackup Bool, --poolmetadataspare Bool + + # used only when the destination VG is new + OO_VGSPLIT_NEW: --alloc Alloc, +diff --git a/tools/vgsplit.c b/tools/vgsplit.c +index 296248e..a085ac2 100644 +--- a/tools/vgsplit.c ++++ b/tools/vgsplit.c +@@ -525,6 +525,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv) + int existing_vg = 0; + int r = ECMD_FAILED; + const char *lv_name; ++ int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE); + + if ((arg_is_set(cmd, name_ARG) + argc) < 3) { + log_error("Existing VG, new VG and either physical volumes " +@@ -699,6 +700,13 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv) + */ + vg_to->status |= EXPORTED_VG; + ++ ++ if (!handle_pool_metadata_spare(vg_to, 0, &vg_to->pvs, poolmetadataspare)) ++ goto_bad; ++ ++ if (!handle_pool_metadata_spare(vg_from, 0, &vg_from->pvs, poolmetadataspare)) ++ goto_bad; ++ + if (!archive(vg_to)) + goto_bad; + diff --git a/SPECS/lvm2.spec b/SPECS/lvm2.spec index fcd41d0..bd9d071 100644 --- a/SPECS/lvm2.spec +++ b/SPECS/lvm2.spec @@ -20,6 +20,7 @@ %global bash_version 4.0 %global corosync_version 1.99.9-1 %global resource_agents_version 3.9.5-12 +# TODO: This needs newer dlm - do I need a side tag??? :-/ %global dlm_version 4.0.9-1 %global libselinux_version 1.30.19-4 %global persistent_data_version 0.7.0-0.1.rc6 @@ -67,7 +68,7 @@ Version: 2.03.12 %if 0%{?from_snapshot} Release: 0.1.20210426git%{shortcommit}%{?dist}%{?rel_suffix} %else -Release: 5%{?dist}%{?rel_suffix} +Release: 6%{?dist}%{?rel_suffix} %endif License: GPLv2 URL: http://sourceware.org/lvm2 @@ -102,6 +103,15 @@ Patch14: lvm2-2_03_13-vdo-support-vdo_pool_header_size.patch Patch15: lvm2-2_03_13-vdo-add-vdoimport-support.patch Patch16: lvm2-2_03_13-man-vdoimport-page.patch Patch17: lvm2-make-generate.patch +# BZ 1967744: +Patch18: lvm2-2_03_13-thin-fix-component-detection-of-external-origin.patch +# BZ 1899263: +Patch19: lvm2-2_03_13-vgremove-remove-forgotten-pmspare.patch +Patch20: lvm2-2_03_13-vgsplit-add-support-for-option-poolmetadataspare.patch +Patch21: lvm2-2_03_13-test.patch +Patch22: lvm2-2_03_13-vgmerge-remove-one-of-merge-pmspare-LVs.patch +Patch23: lvm2-2_03_13-vgmerge-support-option-poolmetadataspare.patch +Patch24: lvm2-2_03_13-tests-extend-vgmerge-testing.patch BuildRequires: gcc %if %{enable_testsuite} @@ -179,6 +189,13 @@ or more physical volumes and creating one or more logical volumes %patch15 -p1 -b .backup15 %patch16 -p1 -b .backup16 %patch17 -p1 -b .backup17 +%patch18 -p1 -b .backup18 +%patch19 -p1 -b .backup19 +%patch20 -p1 -b .backup20 +%patch21 -p1 -b .backup21 +%patch22 -p1 -b .backup22 +%patch23 -p1 -b .backup23 +%patch24 -p1 -b .backup24 %build %global _default_pid_dir /run @@ -422,9 +439,7 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || : %{_sysconfdir}/lvm/profile/cache-mq.profile %{_sysconfdir}/lvm/profile/cache-smq.profile %{_sysconfdir}/lvm/profile/lvmdbusd.profile -%if %{enable_vdo} %{_sysconfdir}/lvm/profile/vdo-small.profile -%endif %dir %{_sysconfdir}/lvm/backup %dir %{_sysconfdir}/lvm/cache %dir %{_sysconfdir}/lvm/archive @@ -789,6 +804,10 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Tue Aug 03 2021 Marian Csontos - 2.03.12-6 +- Fix handling of pmspare by vgsplit, vgmerge and vgremove. +- Fix detection of active components of external origin volume. + * Tue Jul 13 2021 Marian Csontos - 2.03.12-5 - Fix device_id handling of scsi_debug WWID. - Add vdoimport support.