Skip to contentSkip to conversation

xfs: Add test for too-small device with stripe geometry

PATCH Superseded Pavel Reichl 2 participants 3 messages Sep 17, 2020 – Sep 18, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: Add test for too-small device with stripe geometry

Verify hat an attempt to create a too-small device with stripe geometry, is handled gracefully instead of hitting an assert in align_ag_geometry()

---
 tests/xfs/260     | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/260.out |  2 ++
 tests/xfs/group   |  1 +
 3 files changed, 57 insertions(+)
 create mode 100755 tests/xfs/260
 create mode 100644 tests/xfs/260.out
tests/xfs/260 new file +54 -0
new file mode 100755
index 00000000..11c9dc1e
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 YOUR NAME HERE.  All Rights Reserved.
+#
+# FS QA Test 260
+#
+# Verify that an attempt to create a too-small device with stripe geometry,
+# is handled gracefully instead of hitting an assert in align_ag_geometry()
+#
+# This test verifies the problem fixed in kernel with commit
+# (mkfs.xfs: fix ASSERT on too-small device with stripe geometry)
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+#. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+echo 'Silence is golden'
+
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount
+
+localfile="${SCRATCH_MNT}/testfile"
+truncate --size=10444800 $localfile
+
+$MKFS_XFS_PROG -dsu=65536,sw=1 $localfile >> $seqres.full 2>&1
+
+[ $? -ne 1 ] && echo "${MKFS_XFS_PROG} should fail gracefully"
+
+# success, all done
+status=0
+exit
tests/xfs/260.out new file +2 -0
new file mode 100644
index 00000000..18ca517c
@@ -0,0 +1,2 @@
+QA output created by 260
+Silence is golden
tests/xfs/group +1 -0
index ed0d389e..7a6dfed7 100644
@@ -257,6 +257,7 @@
 257 auto quick clone
 258 auto quick clone
 259 auto quick
+260 auto quick mkfs
 261 auto quick quota
 262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 263 auto quick quota
Signature · 1 line
2.26.2
#1 lore raw
Quoted 54 lines · Pavel Reichl

Verify hat an attempt to create a too-small device with stripe geometry, is handled gracefully instead of hitting an assert in align_ag_geometry()

---
 tests/xfs/260     | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/260.out |  2 ++
 tests/xfs/group   |  1 +
 3 files changed, 57 insertions(+)
 create mode 100755 tests/xfs/260
 create mode 100644 tests/xfs/260.out
tests/xfs/260 new file +36 -0
new file mode 100755
index 00000000..11c9dc1e
@@ -0,0 +1,54 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 YOUR NAME HERE.  All Rights Reserved.
+#
+# FS QA Test 260
+#
+# Verify that an attempt to create a too-small device with stripe geometry,
+# is handled gracefully instead of hitting an assert in align_ag_geometry()
+#
+# This test verifies the problem fixed in kernel with commit
+# (mkfs.xfs: fix ASSERT on too-small device with stripe geometry)
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+#. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+echo 'Silence is golden'

tests/xfs/260 line 46

Quoted 10 lines
tests/xfs/260 new file +10 -0
+
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount
+
+localfile="${SCRATCH_MNT}/testfile"
+truncate --size=10444800 $localfile

You could put this file under $TEST_DIR and skip a bunch of formatting and fsck runs of the scratch device.

--D

Quoted 31 lines
tests/xfs/260 new file +8 -0
+
+$MKFS_XFS_PROG -dsu=65536,sw=1 $localfile >> $seqres.full 2>&1
+
+[ $? -ne 1 ] && echo "${MKFS_XFS_PROG} should fail gracefully"
+
+# success, all done
+status=0
+exit
tests/xfs/260.out new file +2 -0
new file mode 100644
index 00000000..18ca517c
@@ -0,0 +1,2 @@
+QA output created by 260
+Silence is golden
tests/xfs/group +1 -0
index ed0d389e..7a6dfed7 100644
@@ -257,6 +257,7 @@
 257 auto quick clone
 258 auto quick clone
 259 auto quick
+260 auto quick mkfs
 261 auto quick quota
 262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 263 auto quick quota
Signature · 1 line
2.26.2
#2 lore raw
Quoted 9 lines

tests/xfs/260 line 46

Quoted 3 lines
tests/xfs/260 new file +2 -0
+localfile="${SCRATCH_MNT}/testfile"
+truncate --size=10444800 $localfile

You could put this file under $TEST_DIR and skip a bunch of formatting and fsck runs of the scratch device.

--D

OK, thanks. Next revision is on the list.