Compare commits
No commits in common. "c8s" and "c8" have entirely different histories.
102
.gitignore
vendored
102
.gitignore
vendored
@ -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
1
.lvm2.metadata
Normal file
@ -0,0 +1 @@
|
||||
e5d4364e823d72b9a08b3aecc13cd677972830f0 SOURCES/LVM2.2.03.14.tgz
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,196 +0,0 @@
|
||||
From ae515916c05218a49b40afaaf26f9c4c0bb55e53 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Sat, 8 Feb 2025 21:51:09 +0100
|
||||
Subject: [PATCH] mirror: enhance error path for pvmove finish
|
||||
|
||||
When the pvmove operation is completing, it attempts to deactivate
|
||||
the temporary mirror and remove its mirror legs. However,
|
||||
if an external tool holds these volumes open, the operation would
|
||||
previously abort entirely, leaving the LVM2 metadata in a partially
|
||||
unusable state that required manual administrative fixes.
|
||||
|
||||
To improve this, the code has been enhanced to handle such scenarios
|
||||
more gracefully. It will now complete the pvmove operation even
|
||||
if some volumes cannot be deactivated, marking them in the metadata
|
||||
with an error segment. While the command will report errors,
|
||||
the metadata will remain in a usable state. The administrator
|
||||
can then remove the orphaned volumes when they are no longer in use.
|
||||
|
||||
(cherry picked from commit ed9468153ec3d9cec8d6fbb9f6b8e09e10427416)
|
||||
---
|
||||
lib/metadata/mirror.c | 93 ++++++++++++++++++++++++++++++++++++++++---
|
||||
tools/pvmove_poll.c | 13 ++++++
|
||||
2 files changed, 101 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
|
||||
index 46da57948..d5c988372 100644
|
||||
--- a/lib/metadata/mirror.c
|
||||
+++ b/lib/metadata/mirror.c
|
||||
@@ -398,6 +398,59 @@ static int _activate_lv_like_model(struct logical_volume *model,
|
||||
return 1;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Inherit tags @from_lv to @to_lv, tags maybe needed for activation
|
||||
+ */
|
||||
+static int _inherit_lv_tags(const struct logical_volume *from_lv, struct logical_volume *to_lv)
|
||||
+{
|
||||
+ struct dm_str_list *sl;
|
||||
+
|
||||
+ if (to_lv && !str_list_match_list(&from_lv->tags, &to_lv->tags, NULL))
|
||||
+ dm_list_iterate_items(sl, &from_lv->tags)
|
||||
+ if (!str_list_add(from_lv->vg->cmd->mem, &to_lv->tags, sl->str)) {
|
||||
+ log_error("Aborting. Unable to inherit tag.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Deactivates and removes an 'orphan' temporary @lv,
|
||||
+ * which is expected to already have an 'error' segment.
|
||||
+ * Sets @updated_mda (!NULL) to 1 when LV is removed.
|
||||
+ * Sets @deactivation_failed (!NULL) to 1 when deactivation fails.
|
||||
+ *
|
||||
+ * Note: An external tool might still have the volume open, preventing
|
||||
+ * immediate deactivation. If deactivation fails (even after retrying),
|
||||
+ * it is safer to proceed with the command and leave the LV visible.
|
||||
+ * This allows the user to manually remove it when it is no longer in use.
|
||||
+ *
|
||||
+ * Any errors will be detected later in the process, as there will be
|
||||
+ * more visible LVs than expected.
|
||||
+ */
|
||||
+static int _deactivate_and_remove_lv(struct logical_volume *lv,
|
||||
+ int *updated_mda,
|
||||
+ int *deactivation_failed)
|
||||
+{
|
||||
+ if (lv) {
|
||||
+ /* FIXME: convert to use lv_active_change() */
|
||||
+ if (!deactivate_lv(lv->vg->cmd, lv)) {
|
||||
+ /* Note: still returns success here and fails later */
|
||||
+ log_warn("WARNING: Can't deactivate temporary volume %s.",
|
||||
+ display_lvname(lv));
|
||||
+ if (deactivation_failed)
|
||||
+ *deactivation_failed = 1;
|
||||
+ } else if (!lv_remove(lv)) {
|
||||
+ /* Can't continue with internal metadata problems */
|
||||
+ return_0;
|
||||
+ } else if (updated_mda)
|
||||
+ *updated_mda = 1;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Delete independent/orphan LV, it must acquire lock.
|
||||
*/
|
||||
@@ -803,7 +856,6 @@ static int _remove_mirror_images(struct logical_volume *lv,
|
||||
struct lv_list *lvl;
|
||||
struct dm_list tmp_orphan_lvs;
|
||||
uint32_t orig_removed = num_removed;
|
||||
- int reactivate;
|
||||
|
||||
if (removed)
|
||||
*removed = 0;
|
||||
@@ -967,6 +1019,19 @@ static int _remove_mirror_images(struct logical_volume *lv,
|
||||
return_0;
|
||||
}
|
||||
|
||||
+ if (!collapse) {
|
||||
+ dm_list_iterate_items(lvl, &tmp_orphan_lvs) {
|
||||
+ if (!_inherit_lv_tags(lv, lvl->lv))
|
||||
+ return_0;
|
||||
+ if (!replace_lv_with_error_segment(lvl->lv))
|
||||
+ return_0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!_inherit_lv_tags(lv, temp_layer_lv) ||
|
||||
+ !_inherit_lv_tags(lv, detached_log_lv))
|
||||
+ return_0;
|
||||
+
|
||||
/*
|
||||
* To successfully remove these unwanted LVs we need to
|
||||
* remove the LVs from the mirror set, commit that metadata
|
||||
@@ -976,17 +1041,35 @@ static int _remove_mirror_images(struct logical_volume *lv,
|
||||
return_0;
|
||||
|
||||
/* Save or delete the 'orphan' LVs */
|
||||
- reactivate = lv_is_active(lv_lock_holder(lv));
|
||||
+ if (lv_is_active(lv_lock_holder(lv))) {
|
||||
+ if (!collapse) {
|
||||
+ dm_list_iterate_items(lvl, &tmp_orphan_lvs)
|
||||
+ if (!_activate_lv_like_model(lv, lvl->lv))
|
||||
+ return_0;
|
||||
+ }
|
||||
+
|
||||
+ if (temp_layer_lv &&
|
||||
+ !_activate_lv_like_model(lv, temp_layer_lv))
|
||||
+ return_0;
|
||||
+
|
||||
+ if (detached_log_lv &&
|
||||
+ !_activate_lv_like_model(lv, detached_log_lv))
|
||||
+ return_0;
|
||||
+
|
||||
+ if (!sync_local_dev_names(lv->vg->cmd))
|
||||
+ stack;
|
||||
+ }
|
||||
+
|
||||
if (!collapse) {
|
||||
dm_list_iterate_items(lvl, &tmp_orphan_lvs)
|
||||
- if (!_delete_lv(lv, lvl->lv, reactivate))
|
||||
+ if (!_deactivate_and_remove_lv(lvl->lv, NULL, NULL))
|
||||
return_0;
|
||||
}
|
||||
|
||||
- if (temp_layer_lv && !_delete_lv(lv, temp_layer_lv, reactivate))
|
||||
+ if (!_deactivate_and_remove_lv(temp_layer_lv, NULL, NULL))
|
||||
return_0;
|
||||
|
||||
- if (detached_log_lv && !_delete_lv(lv, detached_log_lv, reactivate))
|
||||
+ if (!_deactivate_and_remove_lv(detached_log_lv, NULL, NULL))
|
||||
return_0;
|
||||
|
||||
/* Mirror with only 1 area is 'in sync'. */
|
||||
diff --git a/tools/pvmove_poll.c b/tools/pvmove_poll.c
|
||||
index 751313cd7..8b97905c0 100644
|
||||
--- a/tools/pvmove_poll.c
|
||||
+++ b/tools/pvmove_poll.c
|
||||
@@ -87,6 +87,8 @@ int pvmove_update_metadata(struct cmd_context *cmd, struct volume_group *vg,
|
||||
int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg,
|
||||
struct logical_volume *lv_mirr, struct dm_list *lvs_changed)
|
||||
{
|
||||
+ uint32_t visible = vg_visible_lvs(lv_mirr->vg);
|
||||
+
|
||||
if (!dm_list_empty(lvs_changed) &&
|
||||
(!_detach_pvmove_mirror(cmd, lv_mirr) ||
|
||||
!replace_lv_with_error_segment(lv_mirr))) {
|
||||
@@ -94,6 +96,8 @@ int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ lv_set_visible(lv_mirr);
|
||||
+
|
||||
if (!lv_update_and_reload(lv_mirr))
|
||||
return_0;
|
||||
|
||||
@@ -120,5 +124,14 @@ int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ /* Allows the pvmove operation to complete even if 'orphaned' temporary volumes
|
||||
+ * cannot be deactivated due to being held open by another process.
|
||||
+ * The user can manually remove these volumes later when they are no longer in use. */
|
||||
+ if (visible < vg_visible_lvs(lv_mirr->vg)) {
|
||||
+ log_error("ABORTING: Failed to remove temporary logical volume(s).");
|
||||
+ log_print_unless_silent("Please remove orphan temporary logical volume(s) when possible.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 97aa5f67547f150b5f8f511249b200a41561a3c9 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Thu, 27 Jun 2024 12:46:15 -0500
|
||||
Subject: [PATCH 1/2] lvmlockd: vgchange systemid doen't need global lock
|
||||
|
||||
The comment explained that the ex global lock was just
|
||||
used to trigger global cache invalidation, which is no
|
||||
longer needed. This extra locking can cause problems
|
||||
with LVM-activate when local and shared VGs are mixed
|
||||
(and the incorrect exit code for errors was causing
|
||||
problems.)
|
||||
|
||||
(cherry picked from commit 680f7bd676526771b7a26e35105af3bccb95e4a1)
|
||||
---
|
||||
tools/vgchange.c | 11 -----------
|
||||
1 file changed, 11 deletions(-)
|
||||
|
||||
diff --git a/tools/vgchange.c b/tools/vgchange.c
|
||||
index e4b57dbd2..b0e2b2d2a 100644
|
||||
--- a/tools/vgchange.c
|
||||
+++ b/tools/vgchange.c
|
||||
@@ -1231,17 +1231,6 @@ int vgchange_systemid_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||
struct processing_handle *handle;
|
||||
int ret;
|
||||
|
||||
- /*
|
||||
- * This is a special case where taking the global lock is
|
||||
- * not needed to protect global state, because the change is
|
||||
- * only to an existing VG. But, taking the global lock ex is
|
||||
- * helpful in this case to trigger a global cache validation
|
||||
- * on other hosts, to cause them to see the new system_id or
|
||||
- * lock_type.
|
||||
- */
|
||||
- if (!lockd_global(cmd, "ex"))
|
||||
- return 0;
|
||||
-
|
||||
if (!(handle = init_processing_handle(cmd, NULL))) {
|
||||
log_error("Failed to initialize processing handle.");
|
||||
return ECMD_FAILED;
|
||||
--
|
||||
2.49.0
|
||||
|
@ -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
Loading…
Reference in New Issue
Block a user