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

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