Compare commits

...

No commits in common. "c8s" and "c8" have entirely different histories.
c8s ... c8

151 changed files with 2 additions and 1553 deletions

102
.gitignore vendored
View File

@ -1,101 +1 @@
/LVM2.2.02.90.tgz
/LVM2.2.02.91.tgz
/LVM2.2.02.92.tgz
/LVM2.2.02.93.tgz
/LVM2.2.02.94.tgz
/LVM2.2.02.95.tgz
/LVM2.2.02.96.tgz
/LVM2.2.02.97.tgz
/LVM2.2.02.98.tgz
/LVM2.2.02.99.tgz
/LVM2.2.02.102.tgz
/LVM2.2.02.103.tgz
/LVM2.2.02.104.tgz
/LVM2.2.02.105.tgz
/LVM2.2.02.106.tgz
/LVM2.2.02.107.tgz
/LVM2.2.02.108.tgz
/LVM2.2.02.109.tgz
/LVM2.2.02.110.tgz
/LVM2.2.02.111.tgz
/LVM2.2.02.112.tgz
/LVM2.2.02.113.tgz
/LVM2.2.02.114.tgz
/LVM2.2.02.115.tgz
/LVM2.2.02.116.tgz
/LVM2.2.02.118.tgz
/LVM2.2.02.119.tgz
/LVM2.2.02.120.tgz
/LVM2.2.02.122.tgz
/LVM2.2.02.123.tgz
/LVM2.2.02.124.tgz
/LVM2.2.02.125.tgz
/LVM2.2.02.126.tgz
/LVM2.2.02.127.tgz
/LVM2.2.02.128.tgz
/LVM2.2.02.129.tgz
/LVM2.2.02.130.tgz
/LVM2.2.02.131.tgz
/LVM2.2.02.132.tgz
/LVM2.2.02.133.tgz
/LVM2.2.02.134.tgz
/LVM2.2.02.135.tgz
/LVM2.2.02.136.tgz
/LVM2.2.02.137.tgz
/LVM2.2.02.138.tgz
/LVM2.2.02.139.tgz
/LVM2.2.02.140.tgz
/LVM2.2.02.141.tgz
/LVM2.2.02.142.tgz
/LVM2.2.02.143.tgz
/LVM2.2.02.144.tgz
/LVM2.2.02.145.tgz
/LVM2.2.02.146.tgz
/LVM2.2.02.147.tgz
/LVM2.2.02.148.tgz
/LVM2.2.02.149.tgz
/LVM2.2.02.150.tgz
/LVM2.2.02.151.tgz
/LVM2.2.02.152.tgz
/LVM2.2.02.153.tgz
/LVM2.2.02.154.tgz
/LVM2.2.02.155.tgz
/LVM2.2.02.156.tgz
/LVM2.2.02.157.tgz
/LVM2.2.02.158.tgz
/LVM2.2.02.159.tgz
/LVM2.2.02.160.tgz
/LVM2.2.02.161.tgz
/LVM2.2.02.162.tgz
/LVM2.2.02.163.tgz
/LVM2.2.02.164.tgz
/LVM2.2.02.165.tgz
/LVM2.2.02.166.tgz
/LVM2.2.02.167.tgz
/LVM2.2.02.168.tgz
/LVM2.2.02.171.tgz
/LVM2.2.02.172.tgz
/LVM2.2.02.173.tgz
/LVM2.2.02.174.tgz
/LVM2.2.02.175.tgz
/LVM2.2.02.176.tgz
/LVM2.2.02.177.tgz
/LVM2.2.02.179.tgz
/LVM2.2.02.180.tgz
/LVM2.2.02.181.tgz
/LVM2.2.03.00.tgz
/LVM2.2.03.01.tgz
/LVM2.2.03.02.tgz
/LVM2.2.03.04.tgz
/LVM2.2.03.05.tgz
/LVM2.2.03.06.tgz
/LVM2.2.03.07.tgz
/LVM2.2.03.08.tgz
/LVM2.2.03.09.tgz
/lvm2-8801a86.tar.gz
/lvm2-9fe7aba.tar.gz
/lvm2-b84a992.tar.gz
/LVM2.2.03.11.tgz
/lvm2-4dc5d4a.tgz
/LVM2.2.03.12.tgz
/LVM2.2.03.14.tgz
SOURCES/LVM2.2.03.14.tgz

1
.lvm2.metadata Normal file
View File

@ -0,0 +1 @@
e5d4364e823d72b9a08b3aecc13cd677972830f0 SOURCES/LVM2.2.03.14.tgz

View File

@ -1,53 +0,0 @@
From b7334daa69e998b604f59697d7614c54d6373160 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 12 Jan 2022 16:42:01 -0600
Subject: [PATCH 09/12] vgsplit: don't reread vg_to
The destination vg is first written with the EXPORTED flag,
then the source vg is written, then the destination vg is
written again without the EXPORTED flag. Remove an unnecessary
vg_read of the destination vg just before the second write.
(cherry picked from commit 5e428d22d9647a294eba65852078947df5ade48f)
---
tools/vgsplit.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 9d6534e89..c7f4b8af4 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -728,30 +728,6 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
backup(vg_from);
}
- /*
- * Finally, remove the EXPORTED flag from the new VG and write it out.
- * We need to unlock vg_to because vg_read_for_update wants to lock it.
- */
- if (!test_mode()) {
- unlock_vg(cmd, NULL, vg_name_to);
- release_vg(vg_to);
-
- /*
- * This command uses the exported vg flag internally, but
- * exported VGs are not allowed to be split from the command
- * level, so ALLOW_EXPORTED is not set in commands.h.
- */
- cmd->include_exported_vgs = 1;
-
- vg_to = vg_read_for_update(cmd, vg_name_to, NULL, 0, 0);
-
- if (!vg_to) {
- log_error("Volume group \"%s\" became inconsistent: "
- "please fix manually", vg_name_to);
- goto bad;
- }
- }
-
vg_to->status &= ~EXPORTED_VG;
if (!vg_write(vg_to) || !vg_commit(vg_to))
--
2.43.0

View File

@ -1,113 +0,0 @@
From 2ae69ffd78d3dd65843c48e3369b75ae49787fd4 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 12 Jan 2022 16:46:26 -0600
Subject: [PATCH 10/12] lvmcache: remove lvmcache_update_vg_from_write
After a vg_write, this function was used to attempt to
make lvmcache data match the new state written to disk.
It was not updated correctly in a many or most cases,
and the resulting lvmcache is not actually used after
vg_write, making the update unnecessary.
(cherry picked from commit cb798ee1c102aadde93965a894c5aa59d4e76e4a)
---
lib/cache/lvmcache.c | 44 -----------------------------------------
lib/cache/lvmcache.h | 1 -
lib/metadata/metadata.c | 7 -------
3 files changed, 52 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 04e9f0605..85a1d4806 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2233,50 +2233,6 @@ int lvmcache_update_vgname_and_id(struct cmd_context *cmd, struct lvmcache_info
return 1;
}
-/*
- * FIXME: quit trying to mirror changes that a command is making into lvmcache.
- *
- * First, it's complicated and hard to ensure it's done correctly in every case
- * (it would be much easier and safer to just toss out what's in lvmcache and
- * reread the info to recreate it from scratch instead of trying to make sure
- * every possible discrete state change is correct.)
- *
- * Second, it's unnecessary if commands just use the vg they are modifying
- * rather than also trying to get info from lvmcache. The lvmcache state
- * should be populated by label_scan, used to perform vg_read's, and then
- * ignored (or dropped so it can't be used).
- *
- * lvmcache info is already used very little after a command begins its
- * operation. The code that's supposed to keep the lvmcache in sync with
- * changes being made to disk could be half wrong and we wouldn't know it.
- * That creates a landmine for someone who might try to use a bit of it that
- * isn't being updated correctly.
- */
-
-int lvmcache_update_vg_from_write(struct volume_group *vg)
-{
- char vgid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
- struct pv_list *pvl;
- struct lvmcache_info *info;
- struct lvmcache_vgsummary vgsummary = {
- .vgname = vg->name,
- .vgstatus = vg->status,
- .system_id = vg->system_id,
- .lock_type = vg->lock_type
- };
-
- memcpy(vgid, &vg->id, ID_LEN);
- memcpy(vgsummary.vgid, vgid, ID_LEN);
-
- dm_list_iterate_items(pvl, &vg->pvs) {
- if ((info = lvmcache_info_from_pv_id(&pvl->pv->id, pvl->pv->dev, 0)) &&
- !lvmcache_update_vgname_and_id(vg->cmd, info, &vgsummary))
- return_0;
- }
-
- return 1;
-}
-
/*
* The lvmcache representation of a VG after label_scan can be incorrect
* because the label_scan does not use the full VG metadata to construct
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index 9511bb9e9..2a48786e1 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -84,7 +84,6 @@ void lvmcache_del_dev(struct device *dev);
int lvmcache_update_vgname_and_id(struct cmd_context *cmd, struct lvmcache_info *info,
struct lvmcache_vgsummary *vgsummary);
int lvmcache_update_vg_from_read(struct volume_group *vg, unsigned precommitted);
-int lvmcache_update_vg_from_write(struct volume_group *vg);
void lvmcache_lock_vgname(const char *vgname, int read_only);
void lvmcache_unlock_vgname(const char *vgname);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c4f65366b..fabc6529a 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3102,7 +3102,6 @@ static int _vg_commit_mdas(struct volume_group *vg)
DM_LIST_INIT(ignored);
int failed = 0;
int good = 0;
- int cache_updated = 0;
/* Rearrange the metadata_areas_in_use so ignored mdas come first. */
dm_list_iterate_items_safe(mda, tmda, &vg->fid->metadata_areas_in_use)
@@ -3123,12 +3122,6 @@ static int _vg_commit_mdas(struct volume_group *vg)
failed = 1;
} else
good++;
-
- /* Update cache first time we succeed */
- if (!failed && !cache_updated) {
- lvmcache_update_vg_from_write(vg);
- cache_updated = 1;
- }
}
if (good)
return 1;
--
2.43.0

View File

@ -1,124 +0,0 @@
From 05bb44d8216fb258fa6d4d0c237ea5c00085dc9e Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 6 Jan 2022 10:15:16 -0600
Subject: [PATCH 11/12] handle duplicate vgids
The approach to duplicate VGIDs has been that it is not possible
or not allowed, so the behavior has been undefined. The actual
result was unpredictable and/or broken, and generally unhelpful.
Improve this by recognizing the problem, displaying the VGs,
and printing a warning to fix the problem. Beyond this,
using VGs with duplicate VGIDs remains undefined, but should
work well enough to correct the problem with vgchange -u.
It's possible to create this condition without too much difficulty
by cloning PVs, followed by an incomplete attempt at making the two
VGs unique (vgrename and pvchange -u, but missing vgchange -u.)
(cherry picked from commit 18f451e09e943eb3d51f8394f6fe8967e1e9f565)
---
lib/cache/lvmcache.c | 20 +++++++++++---
test/shell/duplicate-vgid.sh | 52 ++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 4 deletions(-)
create mode 100644 test/shell/duplicate-vgid.sh
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 85a1d4806..9b3c83736 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -354,9 +354,11 @@ static struct lvmcache_vginfo *_vginfo_lookup(const char *vgname, const char *vg
if (vgid_arg) {
if ((vginfo = dm_hash_lookup(_vgid_hash, vgid))) {
if (vgname && strcmp(vginfo->vgname, vgname)) {
- /* should never happen */
- log_error(INTERNAL_ERROR "vginfo_lookup vgid %s has two names %s %s",
- vgid, vginfo->vgname, vgname);
+ log_warn("WARNING: lookup found duplicate VGID %s for VGs %s and %s.", vgid, vginfo->vgname, vgname);
+ if ((vginfo = dm_hash_lookup(_vgname_hash, vgname))) {
+ if (!memcmp(vginfo->vgid, vgid, ID_LEN))
+ return vginfo;
+ }
return NULL;
}
return vginfo;
@@ -1878,7 +1880,17 @@ static int _lvmcache_update_vgname(struct cmd_context *cmd,
_drop_vginfo(info, info->vginfo);
- if (!(vginfo = lvmcache_vginfo_from_vgid(vgid))) {
+ vginfo = lvmcache_vginfo_from_vgid(vgid);
+ if (vginfo && strcmp(vginfo->vgname, vgname)) {
+ log_warn("WARNING: fix duplicate VGID %s for VGs %s and %s (see vgchange -u).", vgid_dashed, vgname, vginfo->vgname);
+ vginfo = lvmcache_vginfo_from_vgname(vgname, NULL);
+ if (vginfo && memcmp(vginfo->vgid, vgid, ID_LEN)) {
+ log_error("Ignoring %s with conflicting VG info %s %s.", dev_name(info->dev), vgid_dashed, vgname);
+ return_0;
+ }
+ }
+
+ if (!vginfo) {
/*
* Create a vginfo struct for this VG and put the vginfo
* into the hash table.
diff --git a/test/shell/duplicate-vgid.sh b/test/shell/duplicate-vgid.sh
new file mode 100644
index 000000000..12163c2f0
--- /dev/null
+++ b/test/shell/duplicate-vgid.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2008-2013 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.
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux prepare_devs 2
+
+vgcreate $vg1 "$dev1"
+vgchange --setautoactivation n $vg1
+UUID1=$(vgs --noheading -o vg_uuid $vg1 | xargs)
+lvcreate -l1 -an -n $lv1 $vg1
+dd if="$dev1" of="$dev2" bs=1M count=1
+aux disable_dev "$dev1"
+vgrename $vg1 $vg2
+pvchange -u "$dev2"
+aux enable_dev "$dev1"
+
+vgs -o+uuid |tee out
+grep $vg1 out | tee out1
+grep $UUID1 out1
+grep $vg2 out | tee out2
+grep $UUID1 out2
+
+vgs $vg1
+vgs $vg2
+lvs $vg1/$lv1
+lvs $vg2/$lv1
+
+lvremove $vg1/$lv1
+lvremove $vg2/$lv1
+
+lvcreate -l1 -an -n $lv2 $vg1
+lvcreate -l1 -an -n $lv3 $vg2
+
+vgchange -u $vg2
+
+vgs -o uuid $vg1 |tee out
+grep $UUID1 out
+
+vgs -o uuid $vg2 |tee out
+not grep $UUID1 out
+
+vgremove -ff $vg1
+vgremove -ff $vg2
--
2.43.0

View File

@ -1,40 +0,0 @@
From c78f2e6ee218d12fb71fc70cd66a21f4ea324a91 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 13 Jan 2022 11:41:09 -0600
Subject: [PATCH 12/12] remove unused variable
resulting from commit cb798ee1c102aadde93965a894c5aa59d4e76e4a
"lvmcache: remove lvmcache_update_vg_from_write"
(cherry picked from commit 0c80ea88477b3511562036748d3bf837bf7b3e8b)
---
lib/metadata/metadata.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index fabc6529a..4f947401f 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3100,7 +3100,6 @@ static int _vg_commit_mdas(struct volume_group *vg)
{
struct metadata_area *mda, *tmda;
DM_LIST_INIT(ignored);
- int failed = 0;
int good = 0;
/* Rearrange the metadata_areas_in_use so ignored mdas come first. */
@@ -3115,11 +3114,9 @@ static int _vg_commit_mdas(struct volume_group *vg)
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->status & MDA_FAILED)
continue;
- failed = 0;
if (mda->ops->vg_commit &&
!mda->ops->vg_commit(vg->fid, vg, mda)) {
stack;
- failed = 1;
} else
good++;
}
--
2.43.0

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJhb+6rAAoJELkRJDHlCQOfBO4P/3d0ccQfFany0wbXfYRuS+1G
HYc0S5LPyhhhTIKRGpBOCEGnSwPlUxcP6mnxhwfrcDOYLl4z9Pj1NGnaYoQxpCHw
fQ4Lzzr6Fdt5TFIkGiVSbQynh/ybyOxfTuD5fMzWmEKrJ1ZNhTv0sDOqPoqLrS8o
W4C573IW9BEGN7CeHTcbcdpnUwt4GGsbsR2S5fGdKUo0Jw/PTY67wiCCTM0F92Qp
S3fkPQ+GWagXTTecrX5MeFjMrQIk3cOMBDvxccHMthzDEyjNtGoOJfmZV66eMzs2
XDW0r6t/h5tX535QOWEjqazYavfUcTQn99+0X4dwbVxVa9h1baKo9bhOM4k7PyOx
XUXDiZYVvsCP/W+Sr69rxOSbzhClg3Y/8riw5Ttf2ygXdUgI7ce0Rnc8irslJCwJ
PyYKFMDxHDaor4LbRJL3ZpaWopoARkRKGJYMsU8VOHDPf0cIfN1JdbOiatqj5CQz
DfCKWzxqz88ZM8GyHxSHZ6bRtEOM6RtCiIONn66AgMHxObKxZ3604BFvv2jaJiVt
MvditBmlvjYaPjNjomSwxgdhs5gkbERJH7kkXgB8RNR2UIPNZhcTSd1xLrkeRpP2
jt7kUR0NR4lab8qal8paIyQLSrcBTsngAI9EYxIgwN1gLcUWfxDJOOJt4tyrqy5v
qcvHOjD884RQSdTYXfe0
=VTpu
-----END PGP SIGNATURE-----

Some files were not shown because too many files have changed in this diff Show More