Blame SOURCES/lvm2-2_03_09-writecache-drop-real-dm-suffix.patch

f41bc7
 lib/misc/lvm-string.c       |  1 -
f41bc7
 lib/writecache/writecache.c |  2 +-
f41bc7
 test/shell/writecache.sh    | 36 ++++++++++++++++++++++++++++++++++++
f41bc7
 3 files changed, 37 insertions(+), 2 deletions(-)
f41bc7
f41bc7
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
f41bc7
index 0ee3403..d8b27cb 100644
f41bc7
--- a/lib/misc/lvm-string.c
f41bc7
+++ b/lib/misc/lvm-string.c
f41bc7
@@ -251,7 +251,6 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
f41bc7
 		 */
f41bc7
 		/* Suffixes used here MUST match lib/activate/dev_manager.c */
f41bc7
 		layer = lv_is_cache_origin(lv) ? "real" :
f41bc7
-			lv_is_writecache_origin(lv) ? "real" :
f41bc7
 			(lv_is_cache(lv) && lv_is_pending_delete(lv)) ? "real" :
f41bc7
 			lv_is_cache_pool_data(lv) ? "cdata" :
f41bc7
 			lv_is_cache_pool_metadata(lv) ? "cmeta" :
f41bc7
diff --git a/lib/writecache/writecache.c b/lib/writecache/writecache.c
f41bc7
index 130922a..08a306e 100644
f41bc7
--- a/lib/writecache/writecache.c
f41bc7
+++ b/lib/writecache/writecache.c
f41bc7
@@ -260,7 +260,7 @@ static int _writecache_add_target_line(struct dev_manager *dm,
f41bc7
 	if ((pmem = lv_on_pmem(seg->writecache)) < 0)
f41bc7
 		return_0;
f41bc7
 
f41bc7
-	if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), "real")))
f41bc7
+	if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), NULL)))
f41bc7
 		return_0;
f41bc7
 
f41bc7
 	if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))
f41bc7
diff --git a/test/shell/writecache.sh b/test/shell/writecache.sh
f41bc7
index 6cd4665..0a7f694 100644
f41bc7
--- a/test/shell/writecache.sh
f41bc7
+++ b/test/shell/writecache.sh
f41bc7
@@ -127,5 +127,41 @@ umount $mount_dir
f41bc7
 lvchange -an $vg/$lv1
f41bc7
 lvchange -an $vg/$lv2
f41bc7
 
f41bc7
+
f41bc7
+# test3: attach writecache to an active LV
f41bc7
+
f41bc7
+lvchange -ay $vg/$lv1
f41bc7
+
f41bc7
+mkfs.xfs -f -s size=4096 "$DM_DEV_DIR/$vg/$lv1"
f41bc7
+
f41bc7
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
f41bc7
+
f41bc7
+cp pattern1 $mount_dir/pattern1
f41bc7
+ls -l $mount_dir
f41bc7
+
f41bc7
+lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1
f41bc7
+
f41bc7
+check lv_field $vg/$lv1 segtype writecache
f41bc7
+
f41bc7
+lvs -a $vg/${lv2}_cvol --noheadings -o segtype >out
f41bc7
+grep linear out
f41bc7
+
f41bc7
+cp pattern1 $mount_dir/pattern1.after
f41bc7
+
f41bc7
+diff pattern1 $mount_dir/pattern1
f41bc7
+diff pattern1 $mount_dir/pattern1.after
f41bc7
+
f41bc7
+umount $mount_dir
f41bc7
+lvchange -an $vg/$lv1
f41bc7
+lvchange -ay $vg/$lv1
f41bc7
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
f41bc7
+
f41bc7
+diff pattern1 $mount_dir/pattern1
f41bc7
+diff pattern1 $mount_dir/pattern1.after
f41bc7
+
f41bc7
+umount $mount_dir
f41bc7
+lvchange -an $vg/$lv1
f41bc7
+lvremove $vg/$lv1
f41bc7
+
f41bc7
 vgremove -ff $vg
f41bc7