mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 3 years ago
Clone

Blame SOURCES/0002-Merge-master-up-to-commit-be61bd6ff5c6.patch

18db87
From f540a18fd7f5f65599a6c85c0bd3ba84e54f1cc8 Mon Sep 17 00:00:00 2001
18db87
From: Marian Csontos <mcsontos@redhat.com>
18db87
Date: Thu, 28 May 2020 18:02:16 +0200
18db87
Subject: [PATCH] Merge master up to commit be61bd6ff5c6
18db87
18db87
---
18db87
 VERSION                           |  2 +-
18db87
 VERSION_DM                        |  2 +-
18db87
 test/shell/cache-single-usage.sh  | 13 +++++++++++++
18db87
 test/shell/integrity-dmeventd.sh  |  8 ++++++++
18db87
 test/shell/integrity-large.sh     |  8 ++++++++
18db87
 test/shell/integrity-misc.sh      |  8 ++++++++
18db87
 test/shell/integrity.sh           |  8 ++++++++
18db87
 test/shell/thin-foreign-repair.sh | 14 ++++++++++----
18db87
 tools/lvconvert.c                 | 15 +++++++++++++++
18db87
 9 files changed, 72 insertions(+), 6 deletions(-)
18db87
18db87
diff --git a/VERSION b/VERSION
18db87
index 00618e0..9ad7a70 100644
18db87
--- a/VERSION
18db87
+++ b/VERSION
18db87
@@ -1 +1 @@
18db87
-2.03.09(2)-RHEL8 (2020-04-21)
18db87
+2.03.09(2)-RHEL8 (2020-05-28)
18db87
diff --git a/VERSION_DM b/VERSION_DM
18db87
index b9ec43e..bcd97de 100644
18db87
--- a/VERSION_DM
18db87
+++ b/VERSION_DM
18db87
@@ -1 +1 @@
18db87
-1.02.171-RHEL8 (2020-04-21)
18db87
+1.02.171-RHEL8 (2020-05-28)
18db87
diff --git a/test/shell/cache-single-usage.sh b/test/shell/cache-single-usage.sh
18db87
index a885bf7..8936aa3 100644
18db87
--- a/test/shell/cache-single-usage.sh
18db87
+++ b/test/shell/cache-single-usage.sh
18db87
@@ -127,4 +127,17 @@ umount "$mount_dir"
18db87
 lvchange -an $vg/$lv1
18db87
 lvchange -an $vg/$lv2
18db87
 
18db87
+# misc tests
18db87
+
18db87
+lvremove $vg
18db87
+
18db87
+lvcreate -n $lv1 -l 2 -an $vg "$dev1"
18db87
+lvcreate -n $lv2 -l 2 -an $vg "$dev1"
18db87
+lvcreate -n $lv3 -l 2 -an $vg "$dev2"
18db87
+
18db87
+lvconvert -y --type writecache --cachevol $lv3 $vg/$lv1
18db87
+not lvconvert -y --type writecache --cachevol ${lv3}_cvol $vg/$lv2
18db87
+not lvconvert -y --type cache --cachevol ${lv3}_cvol $vg/$lv2
18db87
+not lvconvert -y --type cache --cachepool ${lv3}_cvol $vg/$lv2
18db87
+
18db87
 vgremove -ff $vg
18db87
diff --git a/test/shell/integrity-dmeventd.sh b/test/shell/integrity-dmeventd.sh
18db87
index ed2436a..296f556 100644
18db87
--- a/test/shell/integrity-dmeventd.sh
18db87
+++ b/test/shell/integrity-dmeventd.sh
18db87
@@ -109,6 +109,14 @@ _wait_recalc() {
18db87
 		sleep 1
18db87
 	done
18db87
 
18db87
+	# TODO: There is some strange bug, first leg of RAID with integrity
18db87
+	# enabled never gets in sync. I saw this in BB, but not when executing
18db87
+	# the commands manually
18db87
+	if test -z "$sync"; then
18db87
+		echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
18db87
+                dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
18db87
+		exit
18db87
+	fi
18db87
 	echo "timeout waiting for recalc"
18db87
 	return 1
18db87
 }
18db87
diff --git a/test/shell/integrity-large.sh b/test/shell/integrity-large.sh
18db87
index 7a333c1..5aba80e 100644
18db87
--- a/test/shell/integrity-large.sh
18db87
+++ b/test/shell/integrity-large.sh
18db87
@@ -95,6 +95,14 @@ _wait_recalc() {
18db87
 		sleep 1
18db87
 	done
18db87
 
18db87
+	# TODO: There is some strange bug, first leg of RAID with integrity
18db87
+	# enabled never gets in sync. I saw this in BB, but not when executing
18db87
+	# the commands manually
18db87
+	if test -z "$sync"; then
18db87
+		echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
18db87
+                dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
18db87
+		exit
18db87
+	fi
18db87
 	echo "timeout waiting for recalc"
18db87
 	return 1
18db87
 }
18db87
diff --git a/test/shell/integrity-misc.sh b/test/shell/integrity-misc.sh
18db87
index a176f18..0d05689 100644
18db87
--- a/test/shell/integrity-misc.sh
18db87
+++ b/test/shell/integrity-misc.sh
18db87
@@ -109,6 +109,14 @@ _wait_recalc() {
18db87
 		sleep 1
18db87
 	done
18db87
 
18db87
+	# TODO: There is some strange bug, first leg of RAID with integrity
18db87
+	# enabled never gets in sync. I saw this in BB, but not when executing
18db87
+	# the commands manually
18db87
+	if test -z "$sync"; then
18db87
+		echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
18db87
+                dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
18db87
+		exit
18db87
+	fi
18db87
 	echo "timeout waiting for recalc"
18db87
 	return 1
18db87
 }
18db87
diff --git a/test/shell/integrity.sh b/test/shell/integrity.sh
18db87
index 6baccf0..77e9430 100644
18db87
--- a/test/shell/integrity.sh
18db87
+++ b/test/shell/integrity.sh
18db87
@@ -204,6 +204,14 @@ _wait_recalc() {
18db87
 		sleep 1
18db87
 	done
18db87
 
18db87
+	# TODO: There is some strange bug, first leg of RAID with integrity
18db87
+	# enabled never gets in sync. I saw this in BB, but not when executing
18db87
+	# the commands manually
18db87
+	if test -z "$sync"; then
18db87
+		echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
18db87
+                dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
18db87
+		exit
18db87
+	fi
18db87
 	echo "timeout waiting for recalc"
18db87
 	return 1
18db87
 }
18db87
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
18db87
index 8b4018e..55e9f62 100644
18db87
--- a/test/shell/thin-foreign-repair.sh
18db87
+++ b/test/shell/thin-foreign-repair.sh
18db87
@@ -17,9 +17,15 @@ SKIP_WITH_LVMPOLLD=1
18db87
 
18db87
 . lib/inittest
18db87
 
18db87
+clean_thin_()
18db87
+{
18db87
+	aux udev_wait
18db87
+	dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" ; }
18db87
+}
18db87
+
18db87
 cleanup_mounted_and_teardown()
18db87
 {
18db87
-	dmsetup remove $THIN || true
18db87
+	clean_thin_ || true
18db87
 	vgremove -ff $vg
18db87
 	aux teardown
18db87
 }
18db87
@@ -56,9 +62,7 @@ dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
18db87
 
18db87
 mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
18db87
 
18db87
-aux udev_wait
18db87
-
18db87
-dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" }
18db87
+clean_thin_
18db87
 
18db87
 lvchange -an $vg/pool
18db87
 
18db87
@@ -72,3 +76,5 @@ lvchange -ay $vg/pool
18db87
 dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
18db87
 
18db87
 fsck -n "$DM_DEV_DIR/mapper/$THIN"
18db87
+
18db87
+# exit calls cleanup_mounted_and_teardown
18db87
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
18db87
index cf93538..8652252 100644
18db87
--- a/tools/lvconvert.c
18db87
+++ b/tools/lvconvert.c
18db87
@@ -4264,6 +4264,11 @@ static int _lvconvert_cachevol_attach_single(struct cmd_context *cmd,
18db87
 		goto out;
18db87
 	}
18db87
 
18db87
+	if (lv_is_cache_vol(cachevol_lv)) {
18db87
+		log_error("LV %s is already used as a cachevol.", display_lvname(cachevol_lv));
18db87
+		goto out;
18db87
+	}
18db87
+
18db87
 	/* Ensure the LV is not active elsewhere. */
18db87
 	if (!lockd_lv(cmd, lv, "ex", 0))
18db87
 		goto_out;
18db87
@@ -4347,6 +4352,11 @@ static int _lvconvert_cachepool_attach_single(struct cmd_context *cmd,
18db87
 			goto out;
18db87
 		}
18db87
 
18db87
+		if (lv_is_cache_vol(cachepool_lv)) {
18db87
+			log_error("LV %s is already used as a cachevol.", display_lvname(cachepool_lv));
18db87
+			goto out;
18db87
+		}
18db87
+
18db87
 		if (cachepool_lv == lv) {
18db87
 			log_error("Use a different LV for cache pool LV and cache LV %s.",
18db87
 				  display_lvname(cachepool_lv));
18db87
@@ -5629,6 +5639,11 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
18db87
 		goto bad;
18db87
 	}
18db87
 
18db87
+	if (lv_is_cache_vol(lv_fast)) {
18db87
+		log_error("LV %s is already used as a cachevol.", display_lvname(lv_fast));
18db87
+		goto bad;
18db87
+	}
18db87
+
18db87
 	/*
18db87
 	 * To permit this we need to check the block size of the fs using lv
18db87
 	 * (recently in libblkid) so that we can use a matching writecache
18db87
-- 
18db87
1.8.3.1
18db87