Compare commits

...

2 Commits

Author SHA1 Message Date
Marian Csontos 41956e6552 Update lvm2 to upstream version 2.03.23
Resolves: RHEL-17210
2023-11-22 19:55:58 +01:00
Marian Csontos bc52b7cb0c Fix previous commit
Resolves: #2212295 #2208039 #2204467
2023-07-13 15:43:37 +02:00
14 changed files with 25 additions and 959 deletions

View File

@ -1,84 +0,0 @@
From ecea7b14c453a58831f2dda5a0aa869ee4601dff Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 24 Apr 2023 15:47:45 -0500
Subject: [PATCH 1/2] fix dev_name use in add_areas_line
This function was relying on dev_name() returning NULL
to indicate no device, but dev_name never returns NULL.
(cherry picked from commit 31cfcf7ce9aab5dd16ba15e48bfe33be849fad4c)
---
lib/activate/dev_manager.c | 45 ++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 16 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 07d58733e..ac3f01718 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3000,34 +3000,47 @@ static int _add_error_area(struct dev_manager *dm, struct dm_tree_node *node,
return 1;
}
+static int _bad_pv_area(struct lv_segment *seg, uint32_t s)
+{
+ struct stat info;
+ const char *name;
+ struct device *dev;
+
+ if (!seg_pvseg(seg, s))
+ return 1;
+ if (!seg_pv(seg, s))
+ return 1;
+ if (!(dev = seg_dev(seg, s)))
+ return 1;
+ if (dm_list_empty(&dev->aliases))
+ return 1;
+ /* FIXME Avoid repeating identical stat in dm_tree_node_add_target_area */
+ name = dev_name(dev);
+ if (stat(name, &info) < 0)
+ return 1;
+ if (!S_ISBLK(info.st_mode))
+ return 1;
+ return 0;
+}
+
int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
struct dm_tree_node *node, uint32_t start_area,
uint32_t areas)
{
+ struct cmd_context *cmd = seg->lv->vg->cmd;
uint64_t extent_size = seg->lv->vg->extent_size;
uint32_t s;
char *dlid;
- struct stat info;
const char *name;
unsigned num_error_areas = 0;
unsigned num_existing_areas = 0;
- /* FIXME Avoid repeating identical stat in dm_tree_node_add_target_area */
for (s = start_area; s < areas; s++) {
-
- /* FIXME: dev_name() does not return NULL! It needs to check if dm_list_empty(&dev->aliases)
- but this knot of logic is too complex to pull apart without careful deconstruction. */
-
- if ((seg_type(seg, s) == AREA_PV &&
- (!seg_pvseg(seg, s) || !seg_pv(seg, s) || !seg_dev(seg, s) ||
- !(name = dev_name(seg_dev(seg, s))) || !*name ||
- stat(name, &info) < 0 || !S_ISBLK(info.st_mode))) ||
- (seg_type(seg, s) == AREA_LV && !seg_lv(seg, s))) {
- if (!seg->lv->vg->cmd->partial_activation) {
- if (!seg->lv->vg->cmd->degraded_activation ||
- !lv_is_raid_type(seg->lv)) {
- log_error("Aborting. LV %s is now incomplete "
- "and '--activationmode partial' was not specified.",
+ if (((seg_type(seg, s) == AREA_PV) && _bad_pv_area(seg, s)) ||
+ ((seg_type(seg, s) == AREA_LV) && !seg_lv(seg, s))) {
+ if (!cmd->partial_activation) {
+ if (!cmd->degraded_activation || !lv_is_raid_type(seg->lv)) {
+ log_error("Aborting. LV %s is incomplete and --activationmode partial was not specified.",
display_lvname(seg->lv));
return 0;
}
--
2.40.1

View File

@ -1,510 +0,0 @@
From fb1e53f229f4bcde07df4b562927e213bd7f8d17 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 22 Mar 2023 13:05:43 -0500
Subject: [PATCH 2/2] raidintegrity: allow snapshots
(cherry picked from commit fd6e113bba5fed5ee41152cde33220294c24ce2b)
---
lib/activate/dev_manager.c | 6 +-
lib/metadata/integrity_manip.c | 5 -
lib/metadata/snapshot_manip.c | 2 -
test/shell/snapshot-raid.sh | 441 +++++++++++++++++++++++++++++++++
4 files changed, 446 insertions(+), 8 deletions(-)
create mode 100644 test/shell/snapshot-raid.sh
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index ac3f01718..1f4d7c98b 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3039,7 +3039,11 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
if (((seg_type(seg, s) == AREA_PV) && _bad_pv_area(seg, s)) ||
((seg_type(seg, s) == AREA_LV) && !seg_lv(seg, s))) {
if (!cmd->partial_activation) {
- if (!cmd->degraded_activation || !lv_is_raid_type(seg->lv)) {
+ if (!cmd->degraded_activation ||
+ (!lv_is_raid_type(seg->lv) &&
+ !lv_is_integrity(seg->lv) &&
+ !lv_is_integrity_metadata(seg->lv) &&
+ !lv_is_integrity_origin(seg->lv))) {
log_error("Aborting. LV %s is incomplete and --activationmode partial was not specified.",
display_lvname(seg->lv));
return 0;
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 456795532..506b9f06b 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -508,11 +508,6 @@ int lv_add_integrity_to_raid(struct logical_volume *lv, struct integrity_setting
return 0;
}
- if (lv_is_origin(lv)) {
- log_error("Integrity cannot be added to snapshot origins.");
- return 0;
- }
-
seg_top = first_seg(lv);
area_count = seg_top->area_count;
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 822b8da77..b34079d08 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -423,8 +423,6 @@ int validate_snapshot_origin(const struct logical_volume *origin_lv)
}
} else if (lv_is_raid_type(origin_lv) && !lv_is_raid(origin_lv)) {
err = "raid subvolumes";
- } else if (lv_is_raid(origin_lv) && lv_raid_has_integrity((struct logical_volume *)origin_lv)) {
- err = "raid with integrity";
}
out:
diff --git a/test/shell/snapshot-raid.sh b/test/shell/snapshot-raid.sh
new file mode 100644
index 000000000..757bf911e
--- /dev/null
+++ b/test/shell/snapshot-raid.sh
@@ -0,0 +1,441 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 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 snapshots of raid
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext4 || skip
+
+mount_dir="mnt"
+mkdir -p "$mount_dir"
+
+snap_dir="mnt_snap"
+mkdir -p "$snap_dir"
+
+_sync_percent() {
+ local checklv=$1
+ get lv_field "$checklv" sync_percent | cut -d. -f1
+}
+
+_wait_sync() {
+ local checklv=$1
+
+ for i in $(seq 1 10) ; do
+ sync=$(_sync_percent "$checklv")
+ echo "sync_percent is $sync"
+
+ if test "$sync" = "100"; then
+ return
+ fi
+
+ sleep 1
+ done
+ echo "timeout waiting for recalc"
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+ return 1
+}
+
+
+# add and remove a snapshot
+
+test_add_del_snap() {
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ touch "$mount_dir/B"
+ not ls "$snap_dir/B"
+ touch "$snap_dir/C"
+ not ls "$mount_dir/C"
+ ls "$mount_dir/A"
+ ls "$snap_dir/A"
+
+ umount "$snap_dir"
+ lvremove -y $vg/snap
+ umount "$mount_dir"
+}
+
+# add and remove snapshot while origin has a missing raid image
+
+test_snap_with_missing_image() {
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ aux disable_dev "$dev1"
+ lvs -a -o+devices $vg
+
+ not lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+
+ aux enable_dev "$dev1"
+ _wait_sync $vg/$lv1
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+
+ aux disable_dev "$dev1"
+ lvs -a -o+devices $vg
+
+ lvremove -y $vg/snap
+
+ aux enable_dev "$dev1"
+ vgextend --restoremissing $vg "$dev1"
+ lvs -a -o+devices $vg
+ _wait_sync $vg/$lv1
+
+ umount "$mount_dir"
+}
+
+# raid image is lost and restored while a snapshot exists
+
+test_missing_image_with_snap() {
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ aux disable_dev "$dev1"
+ lvs -a -o+devices $vg
+
+ touch "$mount_dir/B"
+ not ls "$snap_dir/B"
+ touch "$snap_dir/C"
+ not ls "$mount_dir/C"
+ ls "$mount_dir/A"
+ ls "$snap_dir/A"
+
+ aux enable_dev "$dev1"
+ _wait_sync $vg/$lv1
+
+ ls "$mount_dir/B"
+ ls "$snap_dir/C"
+
+ umount "$snap_dir"
+ lvremove -y $vg/snap
+ umount "$mount_dir"
+}
+
+# add and remove raid image while snapshot exists
+
+test_add_del_image_with_snap() {
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ touch "$mount_dir/B"
+ touch "$snap_dir/C"
+
+ lvconvert -y -m+1 $vg/$lv1 "$dev4"
+ _wait_sync $vg/$lv1
+
+ ls "$mount_dir/B"
+ ls "$snap_dir/C"
+ ls "$mount_dir/A"
+ ls "$snap_dir/A"
+
+ touch "$mount_dir/B2"
+ touch "$snap_dir/C2"
+
+ lvconvert -y -m-1 $vg/$lv1 "$dev4"
+
+ ls "$mount_dir/B"
+ ls "$snap_dir/C"
+ ls "$mount_dir/A"
+ ls "$snap_dir/A"
+ ls "$mount_dir/B2"
+ ls "$snap_dir/C2"
+ umount "$snap_dir"
+ lvremove -y $vg/snap
+
+ umount "$mount_dir"
+}
+
+test_replace_image_with_snap() {
+ # add an image to replace
+ lvconvert -y -m+1 $vg/$lv1 "$dev4"
+ _wait_sync $vg/$lv1
+
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ touch "$mount_dir/B"
+ touch "$snap_dir/C"
+
+ lvconvert -y --replace "$dev4" $vg/$lv1 "$dev5"
+ _wait_sync $vg/$lv1
+
+ ls "$mount_dir/B"
+ ls "$snap_dir/C"
+ ls "$mount_dir/A"
+ ls "$snap_dir/A"
+
+ touch "$mount_dir/B2"
+ touch "$snap_dir/C2"
+
+ umount "$snap_dir"
+ lvremove -y $vg/snap
+
+ # put lv1 back to original state with images on dev1 and dev2
+ lvconvert -y -m-1 $vg/$lv1 "$dev5"
+
+ umount "$mount_dir"
+}
+
+test_repair_image_with_snap() {
+ # add an image to repair
+ lvconvert -y -m+1 $vg/$lv1 "$dev4"
+ _wait_sync $vg/$lv1
+
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ touch "$mount_dir/B"
+ touch "$snap_dir/C"
+
+ aux disable_dev "$dev4"
+ lvs -a -o+devices $vg
+
+ lvconvert -y --repair $vg/$lv1 "$dev5"
+ _wait_sync $vg/$lv1
+
+ ls "$mount_dir/B"
+ ls "$snap_dir/C"
+ ls "$mount_dir/A"
+ ls "$snap_dir/A"
+
+ touch "$mount_dir/B2"
+ touch "$snap_dir/C2"
+
+ umount "$snap_dir"
+ lvremove -y $vg/snap
+
+ aux enable_dev "$dev4"
+ lvs -a -o+devices $vg
+ vgck --updatemetadata $vg
+
+ # put lv1 back to original state with images on dev1 and dev2
+ lvconvert -y -m-1 $vg/$lv1 "$dev5"
+
+ umount "$mount_dir"
+}
+
+test_merge_snap()
+{
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ touch "$mount_dir/B"
+ touch "$snap_dir/C"
+
+ umount "$snap_dir"
+
+ lvconvert --merge $vg/snap
+
+ # the merge will begin once the origin is not in use
+ umount "$mount_dir"
+
+ lvs -a $vg
+ lvchange -an $vg/$lv1
+ lvchange -ay $vg/$lv1
+ lvs -a $vg
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ ls "$mount_dir/A"
+ ls "$mount_dir/C"
+ not ls "$mount_dir/B"
+
+ umount "$mount_dir"
+}
+
+test_extend_snap()
+{
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L8M $vg/$lv1 "$dev3"
+ mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+ touch "$mount_dir/B"
+ touch "$snap_dir/C"
+
+ lvextend -L+8M $vg/snap
+
+ umount "$mount_dir"
+ umount "$snap_dir"
+ lvremove -y $vg/snap
+}
+
+test_fill_snap()
+{
+ mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+ mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+ touch "$mount_dir/A"
+
+ lvcreate -s -n snap -L4M $vg/$lv1 "$dev3"
+
+ lvs -a $vg
+ get lv_field $vg/snap lv_attr | grep "swi-a-s---"
+
+ dd if=/dev/zero of="$mount_dir/1" bs=1M count=1 oflag=sync
+ dd if=/dev/zero of="$mount_dir/2" bs=1M count=1 oflag=sync
+ dd if=/dev/zero of="$mount_dir/3" bs=1M count=1 oflag=sync
+ dd if=/dev/zero of="$mount_dir/4" bs=1M count=1 oflag=sync
+ dd if=/dev/zero of="$mount_dir/5" bs=1M count=1 oflag=sync
+
+ lvs -a $vg
+ get lv_field $vg/snap lv_attr | grep "swi-I-s---"
+ check lv_field $vg/snap data_percent "100.00"
+
+ umount "$mount_dir"
+ lvremove -y $vg/snap
+}
+
+aux prepare_devs 5 200
+
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
+
+lvcreate --type raid1 -m1 -n $lv1 -L128M $vg "$dev1" "$dev2"
+_wait_sync $vg/$lv1
+test_add_del_snap
+test_snap_with_missing_image
+test_missing_image_with_snap
+test_add_del_image_with_snap
+test_replace_image_with_snap
+test_repair_image_with_snap
+test_merge_snap
+test_extend_snap
+test_fill_snap
+lvremove -y $vg/$lv1
+
+lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -L128M $vg "$dev1" "$dev2"
+_wait_sync $vg/${lv1}_rimage_0
+_wait_sync $vg/${lv1}_rimage_1
+_wait_sync $vg/$lv1
+test_add_del_snap
+test_snap_with_missing_image
+test_missing_image_with_snap
+test_add_del_image_with_snap
+test_replace_image_with_snap
+test_repair_image_with_snap
+test_merge_snap
+test_extend_snap
+test_fill_snap
+lvremove -y $vg/$lv1
+
+# Repeat above with cache|writecache on the raid image?
+
+#
+# Add/remove integrity while a snapshot exists
+#
+
+lvcreate --type raid1 -m1 -n $lv1 -L128M $vg "$dev1" "$dev2"
+_wait_sync $vg/$lv1
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+touch "$mount_dir/A"
+
+lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+touch "$mount_dir/B"
+touch "$snap_dir/C"
+
+lvconvert --raidintegrity y $vg/$lv1
+_wait_sync $vg/${lv1}_rimage_0
+_wait_sync $vg/${lv1}_rimage_1
+
+ls "$mount_dir/B"
+ls "$snap_dir/C"
+ls "$mount_dir/A"
+ls "$snap_dir/A"
+
+touch "$mount_dir/B2"
+touch "$snap_dir/C2"
+
+lvconvert --raidintegrity n $vg/$lv1
+
+ls "$mount_dir/B"
+ls "$snap_dir/C"
+ls "$mount_dir/A"
+ls "$snap_dir/A"
+ls "$mount_dir/B2"
+ls "$snap_dir/C2"
+umount "$snap_dir"
+umount "$mount_dir"
+lvremove -y $vg/snap
+lvremove -y $vg/$lv1
+
+#
+# Add integrity not allowed with missing image and snapshot exists
+#
+
+lvcreate --type raid1 -m1 -n $lv1 -L128M $vg "$dev1" "$dev2"
+_wait_sync $vg/$lv1
+mkfs.ext4 "$DM_DEV_DIR/$vg/$lv1"
+
+mount "$DM_DEV_DIR/$vg/$lv1" "$mount_dir"
+touch "$mount_dir/A"
+
+lvcreate -s -n snap -L12M $vg/$lv1 "$dev3"
+mount "$DM_DEV_DIR/$vg/snap" "$snap_dir"
+
+touch "$mount_dir/B"
+touch "$snap_dir/C"
+
+aux disable_dev "$dev1"
+lvs -a $vg
+
+not lvconvert --raidintegrity y $vg/$lv1
+
+aux enable_dev "$dev1"
+lvs -a $vg
+
+umount "$snap_dir"
+umount "$mount_dir"
+lvremove -y $vg/snap
+lvremove -y $vg/$lv1
+
+vgremove -ff $vg
+
--
2.40.1

View File

@ -1,26 +0,0 @@
From 1835574e39e9417b3800469fe80ce47d2210b9a7 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Sun, 23 Apr 2023 12:49:37 +0200
Subject: [PATCH 3/8] lvmdbus: preserve PATH envvar
(cherry picked from commit afc02ae6e7234e1190cedf5c74ca3d6367efd7d1)
---
daemons/lvmdbusd/lvm_shell_proxy.py.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index b8c8fa565..02a776e1d 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -154,6 +154,8 @@ class LVMShellProxy(object):
# If any env variables contain LVM we will propagate them too
for k, v in os.environ.items():
+ if "PATH" in k:
+ local_env[k] = v
if "LVM" in k:
local_env[k] = v
--
2.40.1

View File

@ -1,43 +0,0 @@
From 80b73e2901d470fd3d1f45664626980167091f02 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 25 Apr 2023 14:46:36 -0500
Subject: [PATCH 4/8] lvmcache: fix valgrind error when dropping md duplicate
When lvmcache info is dropped because it's an md component,
then the lvmcache vginfo can also be dropped, but the list
iterator was still using the list head in vginfo, so break
from the loop earlier to avoid it.
(cherry picked from commit 6d262eaf640dead7861c1a7716e216b9bcea75e5)
---
lib/cache/lvmcache.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index b8a9eac25..127d29229 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1503,6 +1503,9 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
*/
dm_list_iterate_items_safe(vginfo, vginfo2, &_vginfos) {
+ char vgid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
+ memcpy(vgid, vginfo->vgid, ID_LEN);
+
dm_list_iterate_items_safe(info, info2, &vginfo->infos) {
dev = info->dev;
device_hint = _get_pvsummary_device_hint(dev->pvid);
@@ -1557,6 +1560,10 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
/* lvmcache_del will also delete vginfo if info was last one */
lvmcache_del(info);
cmd->filter->wipe(cmd, cmd->filter, dev, NULL);
+
+ /* If vginfo was deleted don't continue using vginfo->infos */
+ if (!_search_vginfos_list(NULL, vgid))
+ break;
}
}
}
--
2.40.1

View File

@ -1,31 +0,0 @@
From 0a9228807d0b3901be4ccf29311a955efba4877e Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Fri, 28 Apr 2023 13:31:39 -0500
Subject: [PATCH 5/8] pvck: improve error for write to existing file
(cherry picked from commit c4440b5b495a2d11ff541dd7e7791e2a83c83609)
---
tools/pvck.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/pvck.c b/tools/pvck.c
index 879810b76..0998caaf5 100644
--- a/tools/pvck.c
+++ b/tools/pvck.c
@@ -1444,8 +1444,13 @@ static int _dump_metadata(struct cmd_context *cmd, const char *dump, struct sett
int bad = 0;
if (arg_is_set(cmd, file_ARG)) {
+ struct stat sb;
if (!(tofile = arg_str_value(cmd, file_ARG, NULL)))
return 0;
+ if (!stat(tofile, &sb)) {
+ log_error("File already exists.");
+ return 0;
+ }
}
if (set->mda_num)
--
2.40.1

View File

@ -1,87 +0,0 @@
From 7702262444a5af924d0fc94ff956663aab3505df Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 2 May 2023 16:12:23 -0500
Subject: [PATCH 6/8] lvreduce: make _lvseg_get_stripes handle integrity layer
lvreduce uses _lvseg_get_stripes() which was unable to get raid stripe
info with an integrity layer present. This caused lvreduce on a
raid+integrity LV to fail prematurely when checking stripe parameters.
An unhelpful error message about stripe size would be printed.
(cherry picked from commit 368381fd4022dc99ffe551b30ed75c3ddbc5c5c8)
---
lib/metadata/lv_manip.c | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 2a4e0e88a..add9512ff 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5144,22 +5144,39 @@ int lv_extend_policy_calculate_percent(struct logical_volume *lv,
static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
{
- uint32_t s;
- struct lv_segment *seg_mirr;
+ uint32_t s, a;
+ struct lv_segment *seg_get, *seg_image, *seg_iorig;
+ struct logical_volume *lv_image, *lv_iorig;
/* If segment mirrored, check if images are striped */
- if (seg_is_mirrored(seg))
+ if (seg_is_mirrored(seg)) {
for (s = 0; s < seg->area_count; s++) {
if (seg_type(seg, s) != AREA_LV)
continue;
- seg_mirr = first_seg(seg_lv(seg, s));
- if (seg_is_striped(seg_mirr)) {
- seg = seg_mirr;
+ lv_image = seg_lv(seg, s);
+ seg_image = first_seg(lv_image);
+ seg_get = NULL;
+
+ if (seg_is_integrity(seg_image)) {
+ /* Get stripe values from the iorig layer. */
+ for (a = 0; a < seg_image->area_count; a++) {
+ lv_iorig = seg_lv(seg_image, a);
+ seg_iorig = first_seg(lv_iorig);
+ seg_get = seg_iorig;
+ break;
+ }
+ } else {
+ /* Get stripe values from the image layer. */
+ seg_get = seg_image;
+ }
+
+ if (seg_get && seg_is_striped(seg_get)) {
+ seg = seg_get;
break;
}
}
-
+ }
if (seg_is_striped(seg)) {
*stripesize = seg->stripe_size;
@@ -5168,7 +5185,7 @@ static uint32_t _lvseg_get_stripes(struct lv_segment *seg, uint32_t *stripesize)
if (seg_is_raid(seg)) {
*stripesize = seg->stripe_size;
- return _raid_stripes_count(seg);
+ return _raid_stripes_count(seg);
}
*stripesize = 0;
@@ -5593,7 +5610,7 @@ static int _lvresize_adjust_extents(struct logical_volume *lv,
seg_size /= seg_mirrors;
lp->extents = logical_extents_used + seg_size;
break;
- }
+ }
} else if (new_extents <= logical_extents_used + seg_logical_extents) {
seg_size = new_extents - logical_extents_used;
lp->extents = new_extents;
--
2.40.1

View File

@ -1,96 +0,0 @@
From 50bd94ca38177c18e6d761d012c56227591df68c Mon Sep 17 00:00:00 2001
From: Peter Rajnoha <prajnoha@redhat.com>
Date: Tue, 16 May 2023 17:17:55 +0200
Subject: [PATCH 7/8] toollib: provide proper hint for referencing VG uuid in
case of duplicate VG names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
vgrename does not support -S|--select, so do not provide a hint about
using it. Instead, provide a hint about using VG uuid directly.
vgs
WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
VG #PV #LV #SN Attr VSize VFree
vg1 1 0 0 wz--n- 124.00m 124.00m
vg1 1 0 0 wz--n- 124.00m 124.00m
(vgrename does not support -S|--select)
vgrename vg1 vg2
WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
Multiple VGs found with the same name: skipping vg1
Use VG uuid in place of the VG name.
(vgchange does support -S|--select)
vgchange --addtag a vg1
WARNING: VG name vg1 is used by VGs DXjcSK-gWfu-5gLh-9Kbg-sG49-dtRr-GqXzGL and MVMfyM-sjOa-M2xV-AT4Y-JddR-h4SP-UO5Ttk.
Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
Multiple VGs found with the same name: skipping vg1
Use --select vg_uuid=<uuid> in place of the VG name.
(cherry picked from commit 3b4e7d1625ddc48dd9393f03a59cc6b74113275a)
---
tools/lvmcmdline.c | 12 ++++++++++++
tools/toollib.c | 7 ++++++-
tools/tools.h | 1 +
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index a5bb6a5c5..6bbf1af26 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -179,6 +179,18 @@ static const struct command_function _command_functions[CMD_COUNT] = {
/* Command line args */
+int arg_is_valid_for_command(const struct cmd_context *cmd, int a)
+{
+ int i;
+
+ for (i = 0; i < cmd->cname->num_args; i++) {
+ if (cmd->cname->valid_args[i] == a)
+ return 1;
+ }
+
+ return 0;
+}
+
unsigned arg_count(const struct cmd_context *cmd, int a)
{
return cmd->opt_arg_values ? cmd->opt_arg_values[a].count : 0;
diff --git a/tools/toollib.c b/tools/toollib.c
index 43e628abf..e5ed8a857 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -2313,7 +2313,12 @@ static int _resolve_duplicate_vgnames(struct cmd_context *cmd,
* is unknown.
*/
log_error("Multiple VGs found with the same name: skipping %s", sl->str);
- log_error("Use --select vg_uuid=<uuid> in place of the VG name.");
+
+ if (arg_is_valid_for_command(cmd, select_ARG))
+ log_error("Use --select vg_uuid=<uuid> in place of the VG name.");
+ else
+ log_error("Use VG uuid in place of the VG name.");
+
dm_list_del(&sl->list);
ret = ECMD_FAILED;
}
diff --git a/tools/tools.h b/tools/tools.h
index 36da3bc7e..60952a2aa 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -193,6 +193,7 @@ int repairtype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_v
int dumptype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av);
/* we use the enums to access the switches */
+int arg_is_valid_for_command(const struct cmd_context *cmd, int a);
unsigned arg_count(const struct cmd_context *cmd, int a);
unsigned arg_is_set(const struct cmd_context *cmd, int a);
int arg_from_list_is_set(const struct cmd_context *cmd, const char *err_found, ...);
--
2.40.1

View File

@ -1,37 +0,0 @@
From 41d16e42f88997fda991f86d598bffc19fcd937f Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 17 May 2023 11:10:45 -0500
Subject: [PATCH 8/8] tests: integrity: snapshots now work on raid+integrity
(cherry picked from commit 3a757047560d75a28d7e4c7d9a5253a72d786544)
---
test/shell/integrity.sh | 8 --------
1 file changed, 8 deletions(-)
diff --git a/test/shell/integrity.sh b/test/shell/integrity.sh
index a7dd5b565..d1683a08e 100644
--- a/test/shell/integrity.sh
+++ b/test/shell/integrity.sh
@@ -626,7 +626,6 @@ not lvconvert --splitmirrors 1 -n tmp -y $vg/$lv1
not lvconvert --splitmirrors 1 --trackchanges -y $vg/$lv1
not lvchange --syncaction repair $vg/$lv1
not lvreduce -L4M $vg/$lv1
-not lvcreate -s -n snap -L4M $vg/$lv1
not pvmove -n $vg/$lv1 "$dev1"
not pvmove "$dev1"
_verify_data_on_mnt
@@ -810,11 +809,4 @@ not lvconvert --raidintegrity y $vg/${lv2}_cpool_cdata
not lvconvert --raidintegrity y $vg/${lv2}_cpool_cmeta
lvremove -y $vg/$lv1
-# cannot add integrity to raid that has a snapshot
-
-lvcreate --type raid1 -m1 -n $lv1 -l 8 $vg
-lvcreate -s -n $lv2 -l 8 $vg/$lv1
-not lvconvert --raidintegrity y $vg/$lv1
-lvremove -y $vg/$lv1
-
vgremove -ff $vg
--
2.40.1

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE1QGkeEQK4v0TChvouREkMeUJA58FAmRCTIYACgkQuREkMeUJ
A5/EaRAArFXpfIrbdjMyKWS6X8c+rRyVrYZZbpDos7oXk7KgICFsEAoVoweEgb9Z
oZ48ijR15NyERiajI6v97eVsd+fjGNe6u8g0sW2azOY8teqB4vyMNWQ1BpU2J536
eXxvvd0PhkG4fqf9mTdktkE/wvjM1BeRmWltDbTSyNCMYrHiMKTd2GmpT/x4QchW
K/UCcvqR6Fj+Shb7Z1wyD2RH3JZs4eOaT2VFWx1BOe6sMd+kQBVDqPR9OTyWv+Ss
/3uWUYlrlGQ93gbLVOyGnt2B7fiJzcs5wQGlg97QAaXECAv58C0/2B50jzberk/r
4mPe8KTIWkPsG2iGec5s1cVJvXTuJzs6zp65QGgWSb0T5TC8s7/FNzJgkWYn3gmk
VKvIqjjI+mfdI34124MP1ptfVp1PbQjENTZuwkIpu6tb4fJQfl6QKmaZ42iCLN3z
qT+bB+QkvTIObvML/LRUAFOktj+UKHtFgUBNENLtUdqp0ExfYnunfAlTydUDBSlS
FEOnPB33kYW74GmBc337iG9V9bo+XPA7paZut6xySTDcy6y5sIbgafrHJSin1kAD
AkkAw24WD32Csj9clS3hsb10P3EWnZoi0CnIruoqKQuXc7nf0mDbWXoUSbyYAP4X
T70kY59QIybAYVdUNtgR844WxFY8odXd+g2FaIMzghEW9dga59k=
=QDd4
-----END PGP SIGNATURE-----

16
LVM2.2.03.23.tgz.asc Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE1QGkeEQK4v0TChvouREkMeUJA58FAmVeTdgACgkQuREkMeUJ
A5/TqRAA4dNbhTkVABtVLuaUB4T50ClDMvpMaEHeWzel1vQSJB3sLp27pROxh8S1
iS3Zat/C3LOl/hG+u6IGFf+0nA9YYFVq1aQqwB88mZKBc044rYBntxos8pfuMNet
LYHKrLE0wmSEBpooYNaWJJI08MDsIH5uKb3BfduFfbns7/iRsd8/dsgg7FGgmvXt
lNNwNI5xJUPODNJYm8MgHyEpnwxDzcdNXxGc8e7Ihu5tGWo6a0EmKO/+i+TljCZm
opCAEJbrlVWIdcGsBqZ/QHMq0IYPOH8jxhxclhbp0EsRYVs+PZ43hj2osfGyNOtv
jdeob/Z1OQ1e/yEWBNZVcOX8jgXf1G80Mww+jKfp8GzrYTGOIIlsCsxJSB7i0Isx
Wc+0uUDS4u0GhUhmx+Z4J20legpVKK4HfLFvUJNAstIjuYIC5nQ1o27gdYg1jhS1
oHd2BBwYfydKpqPsTp6TFmVJBZt+5rATOdaUyUmeyjbiEwx0l9q7/hBiUpNOxgAc
IBds40tqmJRFSEUhzA6sE7eIIjeu641hDIXMyvaHKI9h76hYj1ceDYXLovPS/9ue
xfwASHjQR6i6ZB6Vvu46H3c5+zuVttogi5pGz19FxIK4XSsW4etDjDZKPwrcoQae
Oy7BH3/nyME2GTv9btEMcks73MAGSdJMmLM4hJnDGobAK6RA8Co=
=rizq
-----END PGP SIGNATURE-----

Binary file not shown.

View File

@ -1,4 +1,4 @@
%global device_mapper_version 1.02.195
%global device_mapper_version 1.02.197
%global enable_cache 1
%global enable_lvmdbusd 1
@ -50,11 +50,11 @@ Name: lvm2
%if 0%{?rhel}
Epoch: %{rhel}
%endif
Version: 2.03.21
Version: 2.03.23
%if 0%{?from_snapshot}
Release: 0.1.20211115git%{shortcommit}%{?dist}%{?rel_suffix}
%else
Release: 3%{?dist}%{?rel_suffix}
Release: 1%{?dist}%{?rel_suffix}
%endif
License: GPLv2
URL: http://sourceware.org/lvm2
@ -63,30 +63,6 @@ Source0: lvm2-%{shortcommit}.tgz
%else
Source0: ftp://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz
%endif
# BZ 2179430:
Patch1: 0001-fix-dev_name-use-in-add_areas_line.patch
Patch2: 0002-raidintegrity-allow-snapshots.patch
Patch3: 0003-lvmdbus-preserve-PATH-envvar.patch
Patch4: 0004-lvmcache-fix-valgrind-error-when-dropping-md-duplica.patch
# BZ 2188718
Patch5: 0005-pvck-improve-error-for-write-to-existing-file.patch
# BZ 2191683:
Patch6: 0006-lvreduce-make-_lvseg_get_stripes-handle-integrity-la.patch
# BZ 2188480:
#Patch7: 0007-toollib-provide-proper-hint-for-referencing-VG-uuid-.patch
# BZ 2179430:
Patch8: 0008-tests-integrity-snapshots-now-work-on-raid-integrity.patch
# BZ 2212295:
Patch9: 0009-lvresize-fix-multiple-mounts.patch
# BZ 2208039:
Patch10: 0010-device_id-ignore-trailing-underscores-in-t10-wwid-fr.patch
# - 2212968:
Patch11: 0011-device_id-fix-handling-of-non-PV-with-duplicate-seri.patch
# - 2213653:
Patch12: 0012-device_id-ignore-leading-and-trailing-spaces-for-sys.patch
# BZ 2204467:
Patch13: 0013-Fix-multisegment-RAID1-allocator-uses-one-disk-for-b.patch
Patch14: 0014-tests-integrity-caching-ensure-raid-redundancy.patch
BuildRequires: make
BuildRequires: gcc
@ -714,6 +690,10 @@ An extensive functional testsuite for LVM2.
%endif
%changelog
* Wed Nov 22 2023 Marian Csontos <mcsontos@redhat.com> - 2.03.23-1
- Update to upstream version 2.03.23.
- See WHATS_NEW and WHATS_NEW_DM for more information.
* Thu Jul 13 2023 Marian Csontos <mcsontos@redhat.com> - 2.03.21-3
- Fix lvresize fail in case of multiple mountpoints.
- Fix allocator for RAID LVs allocating multiple legs on single device.

View File

@ -1 +1 @@
SHA512 (LVM2.2.03.21.tgz) = 6024811c3fa92afd2fc13a10d1c3542352aa9a016f40c3ef588bd2f5f3e41245fed4b36c8a87d9f7f8dddc6e13b7253396f5c811f99665df27751676dc7b5bde
SHA512 (LVM2.2.03.23.tgz) = 293430a80c7f599d14e77610456d0f44cac8164e6159cd0e2e287462278a89787e289fdb4d481eb8fd6b5eea07a6535c41cb7fdc3deee83df7fea9bf77dcbdaa

View File

@ -1 +1 @@
LVM2.2.03.21.tgz
LVM2.2.03.23.tgz