stable-2.02 - Revert "lvconvert: display warning if raid1 LV image count does not change"
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7e2ceba2fb6ea676960...
Commit: 7e2ceba2fb6ea6769608858f7ce9a88e5ff3eb68
Parent: 7f41d49f497e2b886f197121551db585dff29b6e
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Sep 28 17:17:26 2020 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Sep 28 17:17:26 2020 +0200
Revert "lvconvert: display warning if raid1 LV image count does not change"
This reverts commit 7f41d49f497e2b886f197121551db585dff29b6e as
_lv_raid_change_image_count() already checks for non-changed image count.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1872130
---
lib/metadata/raid_manip.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index b805d956c..f51e9c401 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3234,11 +3234,6 @@ int lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_
const char *level = seg->area_count == 1 ? "raid1 with " : "";
const char *resil = new_count < seg->area_count ? "reducing" : "enhancing";
- if (new_count == seg->area_count) {
- log_warn("Type %s LV %s already has %u images.", lvseg_name(seg), display_lvname(lv), new_count);
- return 1;
- }
-
/* LV must be active to perform raid conversion operations */
if (!lv_is_active(lv)) {
log_error("%s must be active to perform this operation.",
3 years, 7 months
master - tests: add small delay
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bbc164991afc5d28bcf...
Commit: bbc164991afc5d28bcf12bd4709c4137c913e412
Parent: a89ac3bf6f84be5a021691d02bad3ac5e315da78
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 23 22:09:37 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
tests: add small delay
Prevent there is no i.e. udev trying to open our device.
---
test/shell/snapshot-remove-dmsetup.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/shell/snapshot-remove-dmsetup.sh b/test/shell/snapshot-remove-dmsetup.sh
index 19411ce93..2ef65a596 100644
--- a/test/shell/snapshot-remove-dmsetup.sh
+++ b/test/shell/snapshot-remove-dmsetup.sh
@@ -59,7 +59,9 @@ dmsetup resume $vg1-snap
wait $DMPID
-# Try how force removal works
+# Try how force removal works (and wait till there is no user)
+sync
+sleep .5
dmsetup suspend $vg-$lv1
# needs to fail as device is still open
not dmsetup remove --force $vg1-snap &
3 years, 7 months
master - tests: also add thick snap of thin volume
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a89ac3bf6f84be5a021...
Commit: a89ac3bf6f84be5a021691d02bad3ac5e315da78
Parent: ccb58c109ffab7a073e1630e48babf5eae052ee8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 24 20:49:52 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
tests: also add thick snap of thin volume
---
test/shell/vgsplit-thin.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/shell/vgsplit-thin.sh b/test/shell/vgsplit-thin.sh
index a2d0a0b7f..abe9f552f 100644
--- a/test/shell/vgsplit-thin.sh
+++ b/test/shell/vgsplit-thin.sh
@@ -27,6 +27,7 @@ get_devs
vgcreate "$vg1" "${DEVICES[@]}"
lvcreate -T -L8M $vg1/pool1 -V10M -n $lv1 "$dev1" "$dev2"
lvcreate -T -L8M $vg1/pool2 -V10M -n $lv2 "$dev3" "$dev4"
+lvcreate -s -L2M -n snap $vg1/$lv1 "$dev2"
# Test with external origin if available
lvcreate -l1 -an -pr --zero n -n eorigin $vg1 "$dev5"
3 years, 7 months
master - tests: check some common errors
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ccb58c109ffab7a073e...
Commit: ccb58c109ffab7a073e1630e48babf5eae052ee8
Parent: 3e003320a7fed71c203ae833edce38b30a7d06fd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 25 22:47:19 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
tests: check some common errors
Collect some cases users are hitting when working
with thin-pools which has mismatching kernel metadata content with
lvm2 metadata.
---
test/shell/thin-errors.sh | 79 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/test/shell/thin-errors.sh b/test/shell/thin-errors.sh
new file mode 100644
index 000000000..7bdf268e1
--- /dev/null
+++ b/test/shell/thin-errors.sh
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 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 various error conditions user may hit with thin volumes
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+#
+# Main
+#
+aux have_thin 1 3 0 || skip
+aux thin_pool_error_works_32 || skip
+
+aux prepare_vg 2
+
+###############################################
+# Testing failing thin-pool metadata device #
+###############################################
+
+lvcreate -T -L1M --errorwhenfull y $vg/pool
+lvcreate -V2 -n $lv1 $vg/pool
+lvcreate -s -n $lv2 $vg/$lv1
+
+# Prepare old metadata with transaction_id 2
+vgcfgbackup -f mda_tid_2 $vg
+
+lvcreate -s -n $lv3 $vg/$lv1
+lvcreate -s -n $lv4 $vg/$lv1
+lvcreate -s -n $lv5 $vg/$lv1
+
+vgcfgbackup -f mda_tid_5 $vg
+
+# Restore mismatching old metadata with different transaction_id
+vgcfgrestore -f mda_tid_2 --force --yes $vg
+
+
+not lvcreate -s -n $lv5 $vg/$lv1
+
+sed -e 's/transaction_id = 2/transaction_id = 5/g' mda_tid_2 > mda_tid_2_5
+
+# Restore metadata with matching transaction_id,
+# but already existing device in kernel, unknown to lvm2
+vgcfgrestore -f mda_tid_2_5 --force --yes $vg
+
+not lvcreate -s -n $lv5 $vg/$lv1
+# can be tried repeatedly
+not lvcreate -s -n $lv5 $vg/$lv1
+
+
+# Restore matching metadata and check all works
+# and no kernel thin device was lost
+vgcfgrestore -f mda_tid_5 --force --yes $vg
+
+lvcreate -s -n $lv6 $vg/$lv1
+
+lvchange -ay -K $vg
+
+check active $vg $lv1
+check active $vg $lv2
+check active $vg $lv3
+check active $vg $lv4
+check active $vg $lv5
+check active $vg $lv6
+
+vgremove -ff $vg
3 years, 7 months
master - tests: vgsplit of vdo volumes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3e003320a7fed71c203...
Commit: 3e003320a7fed71c203ae833edce38b30a7d06fd
Parent: e2577c037da84442d5afa125772882c6d5caf8de
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 24 21:50:50 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
tests: vgsplit of vdo volumes
---
test/shell/vgsplit-vdo.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/test/shell/vgsplit-vdo.sh b/test/shell/vgsplit-vdo.sh
new file mode 100644
index 000000000..1d5ddf83e
--- /dev/null
+++ b/test/shell/vgsplit-vdo.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 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 vgsplit command options with vdo volumes
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux have_vdo 6 2 0 || skip
+
+aux lvmconf "allocation/vdo_slab_size_mb = 128"
+
+aux prepare_vg 4 2200
+
+lvcreate --vdo -L4G -n $lv1 $vg "$dev1" "$dev2"
+lvcreate --vdo -L4G -n $lv2 $vg "$dev3" "$dev4"
+
+# Cannot move only part of VDO _vdata
+not vgsplit $vg $vg2 "$dev3" |& tee out
+grep "split" out
+
+# Cannot move active VDO
+not vgsplit $vg $vg2 "$dev3" "$dev4" |& tee out
+grep "inactive" out
+
+lvchange -an $vg/$lv2
+
+vgsplit $vg $vg2 "$dev3" "$dev4"
+
+lvchange -ay $vg2/$lv2
+lvs -ao+devices $vg $vg2
+
+# Cannot merge active VDO
+not vgmerge $vg $vg2 |& tee out
+grep "inactive" out
+
+lvchange -an $vg2/$lv2
+
+vgmerge $vg $vg2
+
+lvs -ao+devices $vg
+
+lvchange -ay $vg/$lv2
+
+vgremove -ff $vg
3 years, 7 months
master - makefiles: document supported var in make help
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e2577c037da84442d5a...
Commit: e2577c037da84442d5afa125772882c6d5caf8de
Parent: e414ebef6ece7c89f539f3ca01ad45a0c021575f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Sep 24 15:14:44 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
makefiles: document supported var in make help
---
test/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/Makefile.in b/test/Makefile.in
index 9fa908e52..bbdde7196 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -111,6 +111,7 @@ help:
@echo " LVM_TEST_UNLIMITED Set to get unlimited test log (>32MB)"
@echo " LVM_VALGRIND Enable valgrind testing, execs $$"VALGRIND.
@echo " LVM_VALGRIND_DMEVENTD Enable valgrind testing of dmeventd (1)."
+ @echo " LVM_VALGRIND_LVMPOLLD Enable valgrind testing of lvmpolld (1)."
@echo " LVM_STRACE Enable strace logging."
@echo " LVM_DEBUG_LEVEL Sets debuging level for valgrind/strace (use > 0)."
@echo " LVM_VERIFY_UDEV Default verify state for lvm.conf."
3 years, 7 months
master - thin: pass through whole code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e414ebef6ece7c89f53...
Commit: e414ebef6ece7c89f539f3ca01ad45a0c021575f
Parent: 2bfa868f911b83f308c0fa3a09751f5b1cbddcfa
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 25 14:34:49 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
thin: pass through whole code
Instead of early 'return 0' let the whole code finish
in case of an error with syncing.
---
lib/metadata/thin_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 588707961..e3364ddc8 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -532,7 +532,7 @@ int update_pool_lv(struct logical_volume *lv, int activate)
if (!sync_local_dev_names(lv->vg->cmd)) {
log_error("Failed to sync local devices LV %s.",
display_lvname(lv));
- return 0;
+ ret = 0;
}
if (activate &&
3 years, 7 months
master - device_mapper: enhance error message
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2bfa868f911b83f308c...
Commit: 2bfa868f911b83f308c0fa3a09751f5b1cbddcfa
Parent: 8b22e3808772601725c0e253f4aa5bed24905271
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 25 19:10:30 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
device_mapper: enhance error message
---
device_mapper/libdm-deptree.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/device_mapper/libdm-deptree.c b/device_mapper/libdm-deptree.c
index 653dd0959..a98b1fcdd 100644
--- a/device_mapper/libdm-deptree.c
+++ b/device_mapper/libdm-deptree.c
@@ -1589,8 +1589,37 @@ static int _thin_pool_node_message(struct dm_tree_node *dnode, struct thin_messa
}
if (!_node_message(dnode->info.major, dnode->info.minor,
- tm->expected_errno, buf))
- return_0;
+ tm->expected_errno, buf)) {
+ switch (m->type) {
+ case DM_THIN_MESSAGE_CREATE_SNAP:
+ case DM_THIN_MESSAGE_CREATE_THIN:
+ if (errno == EEXIST) {
+ /*
+ * ATM errno from ioctl() is preserved through code error path chain
+ * If this would ever change, another way need to be used to
+ * obtain result from failed DM message
+ */
+ log_error("Thin pool %s already contain thin device with device_id %u.",
+ _node_name(dnode), m->u.m_create_snap.device_id);
+ /*
+ * TODO:
+ *
+ * Give some useful advice how to solve this problem,
+ * until lvconvert --repair can handle this automatically
+ */
+ log_error("Manual intervention may be required to remove device dev_id=%u in thin pool metadata.",
+ m->u.m_create_snap.device_id);
+ log_error("Optionally new thin volume with device_id=%u can be manually added into a volume group.",
+ m->u.m_create_snap.device_id);
+ log_warn("WARNING: When uncertain how to do this, contact support!");
+ return 0;
+ }
+ /* fall through */
+ default:
+ return_0;
+ }
+
+ }
return 1;
}
3 years, 7 months
master - thin: improve error message
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8b22e3808772601725c...
Commit: 8b22e3808772601725c0e253f4aa5bed24905271
Parent: ef59c83f2df61b0f0263b0e32dac66eb0cb75488
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 25 22:42:22 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:59:35 2020 +0200
thin: improve error message
Add more info, explaing why the suspend of thin snapshot origin was omitted.
---
lib/thin/thin.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index d759b76e4..9c4bfb39c 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -361,8 +361,11 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
if (!lv_thin_pool_transaction_id(seg->lv, &transaction_id))
return_0; /* Thin pool should exist and work */
if ((transaction_id + 1) != seg->transaction_id) {
- log_error("Can't create snapshot %s as origin %s is not suspended.",
- lmsg->u.lv->name, origin->name);
+ log_error("Omitting suspend of thin snapshot origin %s with expected "
+ "transaction_id " FMTu64 ", but active pool has " FMTu64 ".",
+ display_lvname(origin),
+ !seg->transaction_id ? 0 : seg->transaction_id - 1,
+ transaction_id);
return 0;
}
}
3 years, 7 months
master - thin: enhance lvcreate error paths
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ef59c83f2df61b0f026...
Commit: ef59c83f2df61b0f0263b0e32dac66eb0cb75488
Parent: e2eb1dc501aca4b11997b31978c9ce62916a7c98
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 25 22:43:57 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 25 22:56:40 2020 +0200
thin: enhance lvcreate error paths
Improve error response and reporting, when creating thin snapshots.
If the thin pool kernel metadata already have device with ID lvm2
tries to create, give more meanigful error message and also properly
restore transaction id to the value known to thin-pool in this case.
Before it's been possible to divert by one from kernel TID value,
and lvm2 stacked delete message for such thin device.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 39 ++++++++++++++++++++++++++++++++-------
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 267914382..d50ba762a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.11 -
==================================
+ Enhance reporting and error handling when creating thin volumes.
Enable vgsplit for VDO volumes.
Lvextend of vdo pool volumes ensure at least 1 new VDO slab is added.
Use revert_lv() on reload error path after vg_revert().
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ff86a7ab3..ce532ab92 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7973,6 +7973,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
struct lv_segment *seg, *pool_seg;
int thin_pool_was_active = -1; /* not scanned, inactive, active */
int historical;
+ uint64_t transaction_id;
+ int ret;
if (new_lv_name && lv_name_is_used_in_vg(vg, new_lv_name, &historical)) {
log_error("%sLogical Volume \"%s\" already exists in "
@@ -8441,15 +8443,38 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
log_very_verbose("Cache pool is prepared.");
} else if (lv_is_thin_volume(lv)) {
/* For snapshot, suspend active thin origin first */
- if (origin_lv && lv_is_active(origin_lv) && lv_is_thin_volume(origin_lv)) {
- if (!suspend_lv_origin(cmd, origin_lv)) {
- log_error("Failed to suspend thin snapshot origin %s/%s.",
- origin_lv->vg->name, origin_lv->name);
- goto revert_new_lv;
+ if (origin_lv && lv_is_thin_volume(origin_lv) && lv_is_active(origin_lv)) {
+ if (!(ret = suspend_lv_origin(cmd, origin_lv))) {
+ log_error("Failed to suspend thin snapshot origin %s.",
+ display_lvname(origin_lv));
}
+ /* Note: always proceed with resume_lv() to leave critical_section */
if (!resume_lv_origin(cmd, origin_lv)) { /* deptree updates thin-pool */
- log_error("Failed to resume thin snapshot origin %s/%s.",
- origin_lv->vg->name, origin_lv->name);
+ log_error("Failed to resume thin snapshot origin %s.",
+ display_lvname(origin_lv));
+ if (ret)
+ /* suspend with message was OK, only resume failed */
+ goto revert_new_lv; /* hard to fix things here */
+ }
+ if (!ret) {
+ /* Pool transaction_id has been incremented for this canceled transaction
+ * and needs to be restored to the state from this canceled segment.
+ * TODO: there is low chance actual suspend has failed
+ */
+ if (!lv_thin_pool_transaction_id(pool_lv, &transaction_id)) {
+ log_error("Aborting. Failed to read transaction_id from thin pool %s.",
+ display_lvname(pool_lv)); /* Can't even get thin pool transaction id ??? */
+ } else if (transaction_id != first_seg(pool_lv)->transaction_id) {
+ if (transaction_id == seg->transaction_id)
+ log_debug_metadata("Reverting back transaction_id " FMTu64 " for thin pool %s.",
+ seg->transaction_id, display_lvname(pool_lv));
+ else
+ log_warn("WARNING: Metadata for thin pool %s have transaction_id " FMTu64
+ ", but active pool has " FMTu64 ".",
+ display_lvname(pool_lv), seg->transaction_id, transaction_id);
+ first_seg(pool_lv)->transaction_id = seg->transaction_id;
+ first_seg(lv)->device_id = 0; /* no delete of never existing thin device */
+ }
goto revert_new_lv;
}
/* At this point remove pool messages, snapshot is active */
3 years, 7 months