Blame SOURCES/lvm2-2_03_10-test-repair-of-thin-pool-used-by-foreign-apps.patch

18db87
 test/shell/thin-foreign-repair.sh | 72 +++++++++++++++++++++++++++++++++++++++
18db87
 1 file changed, 72 insertions(+)
18db87
 create mode 100644 test/shell/thin-foreign-repair.sh
18db87
18db87
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
18db87
new file mode 100644
18db87
index 0000000..147a9a0
18db87
--- /dev/null
18db87
+++ b/test/shell/thin-foreign-repair.sh
18db87
@@ -0,0 +1,72 @@
18db87
+#!/usr/bin/env bash
18db87
+
18db87
+# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
18db87
+#
18db87
+# This copyrighted material is made available to anyone wishing to use,
18db87
+# modify, copy, or redistribute it subject to the terms and conditions
18db87
+# of the GNU General Public License v.2.
18db87
+#
18db87
+# You should have received a copy of the GNU General Public License
18db87
+# along with this program; if not, write to the Free Software Foundation,
18db87
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18db87
+
18db87
+# test foreing user of thin-pool
18db87
+
18db87
+
18db87
+SKIP_WITH_LVMPOLLD=1
18db87
+
18db87
+. lib/inittest
18db87
+
18db87
+cleanup_mounted_and_teardown()
18db87
+{
18db87
+	dmsetup remove $THIN || true
18db87
+	vgremove -ff $vg
18db87
+	aux teardown
18db87
+}
18db87
+
18db87
+#
18db87
+# Main
18db87
+#
18db87
+aux have_thin 1 0 0 || skip
18db87
+which mkfs.ext4 || skip
18db87
+
18db87
+# Use our mkfs config file to get approximately same results
18db87
+# TODO: maybe use it for all test via some 'prepare' function
18db87
+export MKE2FS_CONFIG="$TESTOLDPWD/lib/mke2fs.conf"
18db87
+
18db87
+aux prepare_vg 2 64
18db87
+
18db87
+# Create named pool only
18db87
+lvcreate -L2 -T $vg/pool
18db87
+
18db87
+POOL="$vg-pool"
18db87
+THIN="${PREFIX}_thin"
18db87
+
18db87
+# Foreing user is using own ioctl command to create thin devices
18db87
+dmsetup message $POOL 0 "create_thin 0"
18db87
+dmsetup message $POOL 0 "set_transaction_id 0 2"
18db87
+
18db87
+# Once the transaction id has changed, lvm2 shall not be able to create thinLV
18db87
+fail lvcreate -V10 $vg/pool
18db87
+
18db87
+trap 'cleanup_mounted_and_teardown' EXIT
18db87
+
18db87
+# 20M thin device
18db87
+dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
18db87
+
18db87
+mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
18db87
+
18db87
+dmsetup remove "$THIN"
18db87
+
18db87
+lvchange -an $vg/pool
18db87
+
18db87
+# Repair thin-pool used by 'foreing' apps (setting their own tid)
18db87
+lvconvert --repair $vg/pool 2>&1 | tee out
18db87
+
18db87
+not grep "Transaction id" out
18db87
+
18db87
+lvchange -ay $vg/pool
18db87
+
18db87
+dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
18db87
+
18db87
+fsck -n "$DM_DEV_DIR/mapper/$THIN"