mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

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

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