main - thin: ignore parallel merge while polling
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a60c8748eac2e6f0475...
Commit: a60c8748eac2e6f047532b6d106492d120860608
Parent: 8cbe4a171e093aa7de9e16115b13ee3852545d07
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 17 11:17:32 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 18 18:34:57 2021 +0100
thin: ignore parallel merge while polling
If the thin volume has no merging snapshot,
(being already merged) there is nothing to check.
---
tools/lvconvert_poll.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/lvconvert_poll.c b/tools/lvconvert_poll.c
index b64cffe21..50d47164f 100644
--- a/tools/lvconvert_poll.c
+++ b/tools/lvconvert_poll.c
@@ -179,7 +179,10 @@ progress_t poll_thin_merge_progress(struct cmd_context *cmd,
{
uint32_t device_id = 0;
- if (!lv_thin_device_id(lv, &device_id) || !lv->snapshot) {
+ if (!lv->snapshot)
+ return PROGRESS_FINISHED_ALL; /* Already merged by someone else */
+
+ if (!lv_thin_device_id(lv, &device_id)) {
stack;
return PROGRESS_CHECK_FAILED;
}
3 years, 1 month
main - thin: add extra protection
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8cbe4a171e093aa7de9...
Commit: 8cbe4a171e093aa7de9e16115b13ee3852545d07
Parent: d682ad619a50827116fb83ff98efa0e5b8821956
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 17 09:13:20 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 18 18:34:57 2021 +0100
thin: add extra protection
Check explicitely created LV already has thin segment.
As currenlty it's the only user - this patch should have no impact.
---
lib/metadata/lv_manip.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 84667f445..3fff66b18 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8500,8 +8500,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
if (lp->error_when_full)
lv->status |= LV_ERROR_WHEN_FULL;
- } else if (pool_lv && lv_is_virtual(lv)) { /* going to be a thin volume */
- seg = first_seg(lv);
+ } else if (pool_lv && lv_is_virtual(lv) && /* not yet thin LV */
+ (seg = first_seg(lv)) &&
+ seg_is_thin(seg)) { /* going to be a thin volume */
pool_seg = first_seg(pool_lv);
if (!(seg->device_id = get_free_pool_device_id(pool_seg)))
return_NULL;
3 years, 1 month
main - cleanup: simplier check first
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d682ad619a50827116f...
Commit: d682ad619a50827116fb83ff98efa0e5b8821956
Parent: a481fdaa3529a85e0cde652f79b98b2337c296cb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 17 08:56:23 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 18 18:34:57 2021 +0100
cleanup: simplier check first
---
lib/metadata/lv_manip.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 12b1505df..84667f445 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8471,10 +8471,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
/* Unlock memory if possible */
memlock_unlock(vg->cmd);
- if (segtype_is_vdo(create_segtype) && pool_lv) {
+ if (pool_lv && segtype_is_vdo(create_segtype))
if (!set_lv_segment_area_lv(first_seg(lv), 0, pool_lv, 0, LV_VDO_POOL))
return_NULL;
- }
if (lv_is_cache_pool(lv)) {
if (!cache_set_params(first_seg(lv),
3 years, 1 month
main - man: lvmlockd use of lvmlockctl_kill_command
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a481fdaa3529a85e0cd...
Commit: a481fdaa3529a85e0cde652f79b98b2337c296cb
Parent: 583cf413d530927bccf2b7a11f3d5690edca4f8d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Mar 17 13:00:47 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Mar 17 13:02:51 2021 -0500
man: lvmlockd use of lvmlockctl_kill_command
---
man/lvmlockd.8_main | 89 ++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 65 insertions(+), 24 deletions(-)
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index f4c504d70..d1eee63fc 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -576,32 +576,73 @@ If the PV under a sanlock VG's lvmlock LV is disconnected, unresponsive or
too slow, sanlock cannot renew the lease for the VG's locks. After some
time, the lease will expire, and locks that the host owns in the VG can be
acquired by other hosts. The VG must be forcibly deactivated on the host
-with the expiring lease before other hosts can acquire its locks.
+with the expiring lease before other hosts can acquire its locks. This is
+necessary for data protection.
+
+When the sanlock daemon detects that VG storage is lost and the VG lease
+is expiring, it runs the command lvmlockctl --kill <vgname>. This command
+emits a syslog message stating that storage is lost for the VG, and that
+LVs in the VG must be immediately deactivated.
+
+If no LVs are active in the VG, then the VG lockspace will be removed, and
+errors will be reported when trying to use the VG. Use the lvmlockctl
+--drop command to clear the stale lockspace from lvmlockd.
+
+If the VG has active LVs, they must be quickly deactivated before the
+locks expire. After all LVs are deactivated, run lvmlockctl --drop
+<vgname> to clear the expiring lockspace from lvmlockd.
+
+If all LVs in the VG are not deactivated within about 40 seconds, sanlock
+uses wdmd and the local watchdog to reset the host. The machine reset is
+effectively a severe form of "deactivating" LVs before they can be
+activated on other hosts. The reset is considered a better alternative
+than having LVs used by multiple hosts at once, which could easily damage
+or destroy their content.
+
+.B sanlock lease storage failure automation
When the sanlock daemon detects that the lease storage is lost, it runs
-the command lvmlockctl --kill <vgname>. This command emits a syslog
-message stating that lease storage is lost for the VG, and LVs must be
-immediately deactivated.
-
-If no LVs are active in the VG, then the lockspace with an expiring lease
-will be removed, and errors will be reported when trying to use the VG.
-Use the lvmlockctl --drop command to clear the stale lockspace from
-lvmlockd.
-
-If the VG has active LVs when the lock storage is lost, the LVs must be
-quickly deactivated before the lockspace lease expires. After all LVs are
-deactivated, run lvmlockctl --drop <vgname> to clear the expiring
-lockspace from lvmlockd. If all LVs in the VG are not deactivated within
-about 40 seconds, sanlock uses wdmd and the local watchdog to reset the
-host. The machine reset is effectively a severe form of "deactivating"
-LVs before they can be activated on other hosts. The reset is considered
-a better alternative than having LVs used by multiple hosts at once, which
-could easily damage or destroy their content.
-
-In the future, the lvmlockctl kill command may automatically attempt to
-forcibly deactivate LVs before the sanlock lease expires. Until then, the
-user must notice the syslog message and manually deactivate the VG before
-sanlock resets the machine.
+the command lvmlockctl --kill <vgname>. This lvmlockctl command can be
+configured to run another command to forcibly deactivate LVs, taking the
+place of the manual process described above. The other command is
+configured in the lvm.conf lvmlockctl_kill_command setting. The VG name
+is appended to the end of the command specified.
+
+The lvmlockctl_kill_command should forcibly deactivate LVs in the VG,
+ensuring that existing writes to LVs in the VG are complete and that
+further writes to the LVs in the VG will be rejected. If it is able to do
+this successfully, it should exit with success, otherwise it should exit
+with an error. If lvmlockctl --kill gets a successful result from
+lvmlockctl_kill_command, it tells lvmlockd to drop locks for the VG (the
+equivalent of running lvmlockctl --drop). If this completes in time, a
+machine reset can be avoided.
+
+One possible option is to create a script my_vg_kill_script.sh:
+.nf
+ #!/bin/bash
+ VG=$1
+ # replace dm table with the error target for top level LVs
+ dmsetup wipe_table -S "uuid=~LVM && vgname=$VG && lv_layer=\\"\\""
+ # check that the error target is in place
+ dmsetup table -c -S "uuid=~LVM && vgname=$VG && lv_layer=\\"\\"" |grep -vw error
+ if [[ $? -ne 0 ]] ; then
+ exit 0
+ fi
+ exit 1
+.fi
+
+Set in lvm.conf:
+.nf
+ lvmlockctl_kill_command="/usr/sbin/my_vg_kill_script.sh"
+.fi
+
+(The script and dmsetup commands should be tested with the actual VG to
+ensure that all top level LVs are properly disabled.)
+
+If the lvmlockctl_kill_command is not configured, or fails, lvmlockctl
+--kill will emit syslog messages as described in the previous section,
+notifying the user to manually deactivate the VG before sanlock resets the
+machine.
.B sanlock daemon failure
3 years, 1 month
main - tests: avoid leaking unkilled commands
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=583cf413d530927bccf...
Commit: 583cf413d530927bccf2b7a11f3d5690edca4f8d
Parent: fda7bc1297640d739067727b6165cde0613d1fe3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 17 00:44:45 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100
tests: avoid leaking unkilled commands
Between each new test here we want to kill previous commands,
otherwise they will influence results of next test.
---
test/shell/pvmove-resume-multiseg.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/shell/pvmove-resume-multiseg.sh b/test/shell/pvmove-resume-multiseg.sh
index a8e409f56..3a92dbaf3 100644
--- a/test/shell/pvmove-resume-multiseg.sh
+++ b/test/shell/pvmove-resume-multiseg.sh
@@ -78,6 +78,9 @@ test_pvmove_resume() {
aux prepare_clvmd
fi
+## rm -f debug.log_DEBUG*
+# lvs -ao+devices $vg
+
# call resume function (see below)
# with expected number of spawned
# bg polling as parameter
@@ -153,7 +156,7 @@ pvmove_fg() {
aux enable_dev "$dev4"
aux enable_dev "$dev5"
- pvmove
+ LVM_TEST_TAG="kill_me_$PREFIX" pvmove
}
pvmove_bg() {
@@ -198,8 +201,8 @@ pvmove_fg_single() {
aux enable_dev "$dev4"
aux enable_dev "$dev5"
- pvmove "$dev1"
- pvmove "$dev3"
+ LVM_TEST_TAG="kill_me_$PREFIX" pvmove "$dev1"
+ LVM_TEST_TAG="kill_me_$PREFIX" pvmove "$dev3"
}
pvmove_bg_single() {
3 years, 1 month
main - tests: wait for Aa status
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fda7bc1297640d73906...
Commit: fda7bc1297640d739067727b6165cde0613d1fe3
Parent: 80d0f200d00727f591569512ea04d9b50c22ae59
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 17 00:00:03 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100
tests: wait for Aa status
---
test/shell/lvconvert-raid.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 6aaaf3669..87eb7b53c 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -232,6 +232,11 @@ lvcreate -aey -l 2 -n $lv1 $vg "$dev1"
lvconvert -y -m 1 $vg/$lv1 \
--config 'global { mirror_segtype_default = "raid1" }' "$dev2"
lvs --noheadings -o attr $vg/$lv1 | grep '^[[:space:]]*r'
+for i in {1..10}; do
+ check raid_leg_status $vg $lv1 "Aa" && break
+ check raid_leg_status $vg $lv1 "aa" || die "Cannot wait for Aa on $vg/$lv1"
+ sleep .1
+done
not lvconvert --yes -m 0 $vg/$lv1 "$dev1"
lvconvert --yes -m 0 $vg/$lv1 "$dev2"
aux enable_dev "$dev2"
3 years, 1 month
main - tests: increase version of targets for progress
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=80d0f200d00727f5915...
Commit: 80d0f200d00727f591569512ea04d9b50c22ae59
Parent: e793ff1e185acfdbbbedb85a420d48527cd57c90
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 16 22:59:01 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100
tests: increase version of targets for progress
---
test/shell/lvextend-raid.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/shell/lvextend-raid.sh b/test/shell/lvextend-raid.sh
index e8bd7deea..9370bf295 100644
--- a/test/shell/lvextend-raid.sh
+++ b/test/shell/lvextend-raid.sh
@@ -17,7 +17,7 @@ SKIP_WITH_LVMPOLLD=1
aux have_raid 1 3 0 || skip
PROGRESS=0
-aux have_raid 1 13 0 && PROGRESS=1
+aux have_raid 1 15 0 && PROGRESS=1
# Use smallest regionsize to save VG space
regionsize=$(getconf PAGESIZE) # in bytes
3 years, 1 month
main - tests: workaround for some raid targets
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e793ff1e185acfdbbbe...
Commit: e793ff1e185acfdbbbedb85a420d48527cd57c90
Parent: db37905d7f59ac0057f6d50c34d8b1095c64d50f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 16 22:53:23 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100
tests: workaround for some raid targets
Problem with some target is that shortly after initialization it
returns incorrect status letters.
---
test/shell/lvcreate-raid-nosync.sh | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/test/shell/lvcreate-raid-nosync.sh b/test/shell/lvcreate-raid-nosync.sh
index dcc248e0c..05ab848a1 100644
--- a/test/shell/lvcreate-raid-nosync.sh
+++ b/test/shell/lvcreate-raid-nosync.sh
@@ -33,6 +33,21 @@ _sync() {
aux restore_from_devtable "$dev1"
}
+# Workaround for raid targets returning 'a' shortly after initialization
+# TODO: maybe there is some workaround to be made on lvm side
+_check_raid_in_loop() {
+ local vg=$1
+ local lv=$2
+ local A=$3
+ local B=$(echo $A | tr A a)
+ for i in {1..10} ; do
+ check raid_leg_status $vg $lv ${A} && return 0
+ # Only when there is initial 'a..a' we will wait for a while
+ check raid_leg_status $vg $lv ${B} || break
+ sleep .05
+ done
+ die "Cannot get $A status for $vg/$lv";
+}
# Delay 1st leg so that rebuilding status characters
# can be read before resync finished too quick.
@@ -42,7 +57,7 @@ aux delay_dev "$dev1" 0 100 "$(get first_extent_sector "$dev1")"
for r in raid0 raid0_meta
do
lvcreate --type $r -Zn -i 3 -l 1 -n $lv1 $vg
- check raid_leg_status $vg $lv1 "AAA"
+ _check_raid_in_loop $vg $lv1 "AAA"
lvremove --yes $vg/$lv1
done
@@ -53,7 +68,7 @@ _sync "AAA"
# raid1 supports --nosync
lvcreate --type raid1 --nosync -Zn -m 2 -l 1 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "AAA"
+_check_raid_in_loop $vg $lv1 "AAA"
lvremove --yes $vg/$lv1
for r in $segtypes
@@ -65,7 +80,7 @@ do
# raid4/5 support --nosync
lvcreate --type $r -Zn --nosync -i 3 -l 1 -n $lv2 $vg
- check raid_leg_status $vg $lv2 "AAAA"
+ _check_raid_in_loop $vg $lv2 "AAAA"
lvremove --yes $vg
done
@@ -84,6 +99,6 @@ _sync "AAAAAA"
# raid10 supports --nosync
lvcreate --type raid10 --nosync -m 1 -Zn -i 3 -l 1 -n $lv1 $vg
-check raid_leg_status $vg $lv1 "AAAAAA"
+_check_raid_in_loop $vg $lv1 "AAAAAA"
vgremove -ff $vg
3 years, 1 month
main - tests: no further fixes likely to be expected
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=db37905d7f59ac0057f...
Commit: db37905d7f59ac0057f6d50c34d8b1095c64d50f
Parent: 87659256f043ba7a76716cb8c97c350d723209db
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 16 21:40:30 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100
tests: no further fixes likely to be expected
Skip tests for these kernels.
---
test/shell/lvconvert-raid-reshape-stripes-load-fail.sh | 2 +-
test/shell/lvconvert-raid-reshape-stripes-load-reload.sh | 3 ++-
test/shell/lvconvert-raid-reshape-stripes-load.sh | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
index 220cd365c..da9d34798 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
@@ -18,7 +18,7 @@ SKIP_WITH_LVMPOLLD=1
# Test reshaping under io load
case "$(uname -r)" in
- 3.10.0-862*) die "Cannot run this test on unfixed kernel." ;;
+ 3.10.0-862*) skip "Cannot run this test on unfixed kernel." ;;
esac
which mkfs.ext4 || skip
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
index 3023782dd..3b6150909 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
@@ -22,7 +22,8 @@ which mkfs.ext4 || skip
aux have_raid 1 13 2 || skip
case "$(uname -r)" in
- 5.[891]*|3.10.0-862*) die "Cannot run this test on unfixed kernel." ;;
+ 5.[891]*) die "Cannot run this test on unfixed kernel." ;;
+ 3.10.0-862*) skip "Cannot run this test on unfixed kernel." ;;
4.18.0-*.el8*)
REL="$(uname -r)"
REL="${REL#4.18.0-}"
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load.sh b/test/shell/lvconvert-raid-reshape-stripes-load.sh
index 6184e9d64..68ab8b92b 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load.sh
@@ -16,7 +16,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
case "$(uname -r)" in
- 3.10.0-862*) die "Cannot run this test on unfixed kernel." ;;
+ 3.10.0-862*) skip "Cannot run this test on unfixed kernel." ;;
esac
# Test reshaping under io load
3 years, 1 month
main - tests: require newer version of raid target
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=87659256f043ba7a767...
Commit: 87659256f043ba7a76716cb8c97c350d723209db
Parent: 92ee16f7c0d5d6983b90fe97d31e2884a8e5804d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 16 21:37:19 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Mar 17 00:59:50 2021 +0100
tests: require newer version of raid target
---
test/shell/lvconvert-raid-regionsize.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/shell/lvconvert-raid-regionsize.sh b/test/shell/lvconvert-raid-regionsize.sh
index 924e95a39..23d54d05f 100644
--- a/test/shell/lvconvert-raid-regionsize.sh
+++ b/test/shell/lvconvert-raid-regionsize.sh
@@ -85,7 +85,7 @@ else
echo "Skipping RAID6 tests"
fi
-if aux have_raid 1 10 1; then
+if aux have_raid 1 12 0; then
# Create 6-way raid01
lvcreate --yes -aey --type raid10 -i 3 -m 1 --stripesize 128K -R 256K -L8M -n $lv1 $vg
check lv_field $vg/$lv1 segtype "raid10"
3 years, 1 month