lvm2/SOURCES/lvm2-2_03_13-thin-fix-component-detection-of-external-origin.patch

64 lines
2.3 KiB
Diff
Raw Normal View History

2021-08-12 04:20:28 +00:00
WHATS_NEW | 1 +
lib/activate/activate.c | 5 ++++-
test/shell/lvconvert-cache-thin.sh | 22 ++++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5806ecb..097160e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.13 -
===============================
+ Fix detection of active components of external origin volume.
Add vdoimport tool to support conversion of VDO volumes.
Support configurable allocation/vdo_pool_header_size.
Fix handling of lvconvert --type vdo-pool --virtualsize.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 6bda738..94fc944 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2740,7 +2740,10 @@ static int _component_cb(struct logical_volume *lv, void *data)
(lv_is_thin_pool(lv) && pool_is_active(lv)))
return -1;
- if (lv_is_active(lv)) {
+ /* External origin is activated through thinLV and uses -real suffix.
+ * Note: for old clustered logic we would need to check for all thins */
+ if ((lv_is_external_origin(lv) && lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0)) ||
+ lv_is_active(lv)) {
if (!lv_is_component(lv) || lv_is_visible(lv))
return -1; /* skip whole subtree */
diff --git a/test/shell/lvconvert-cache-thin.sh b/test/shell/lvconvert-cache-thin.sh
index 7dda6e6..9254239 100644
--- a/test/shell/lvconvert-cache-thin.sh
+++ b/test/shell/lvconvert-cache-thin.sh
@@ -67,4 +67,26 @@ fail lvconvert --yes --thinpool $vg/$lv1 --poolmetadata $vg/$lv
# Thin-pool CAN use cached data LV
lvconvert --yes --thinpool $vg/$lv
+lvremove -f $vg
+
+# Check we can active snapshot of cached external origin (BZ: 1967744)
+lvcreate -T -L10M $vg/pool "$dev1"
+
+lvcreate -L10M -n origin $vg "$dev1"
+lvcreate -H -L4M -n CPOOL $vg/origin "$dev2"
+
+# Use cached origin as external origin
+lvconvert -y -T --thinpool $vg/pool --originname extorig origin
+
+# Check we can easily create snapshot of such LV
+lvcreate -y -kn -n snap -s $vg/origin
+
+# Deactivate everything and do a component activation of _cmeta volume
+lvchange -an $vg
+lvchange -ay -y $vg/CPOOL_cpool_cmeta
+
+# Now this must fail since component volume is active
+not lvcreate -y -kn -n snap2 -s $vg/origin |& tee err
+grep "cmeta is active" err
+
vgremove -f $vg