]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
tests: _fail on _scratch_mkfs_sized failure
authorDavid Disseldorp <ddiss@suse.de>
Mon, 29 Apr 2024 15:37:52 +0000 (01:37 +1000)
committerZorro Lang <zlang@kernel.org>
Sun, 12 May 2024 12:28:48 +0000 (20:28 +0800)
If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the
provided size, tests may subsequently mount and run atop a previously
created (e.g. non-size-bound) filesystem.
This can lead to difficult to debug failures, or for some -ENOSPC
exercising tests, near infinite runtimes. Avoid this by renaming the
current function to _try_scratch_mkfs_sized() and _fail in the parent
_scratch_mkfs_sized() wrapper.

[zlang: change _fail output, remove missed _fail in b/007, fix g/466]

Suggested-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
16 files changed:
common/rc
tests/btrfs/004
tests/btrfs/007
tests/ext4/021
tests/ext4/059
tests/generic/015
tests/generic/077
tests/generic/083
tests/generic/171
tests/generic/172
tests/generic/173
tests/generic/174
tests/generic/466
tests/generic/735
tests/xfs/015
tests/xfs/057

index 56f1afb6dccdfabb96e8f1b2eee8991231acc05a..3f4864d0fbaff9df3a73d0cc360755b6573c9bae 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -968,8 +968,8 @@ _small_fs_size_mb()
 }
 
 # Create fs of certain size on scratch device
-# _scratch_mkfs_sized <size in bytes> [optional blocksize]
-_scratch_mkfs_sized()
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+_try_scratch_mkfs_sized()
 {
        local fssize=$1
        local blocksize=$2
@@ -1111,6 +1111,11 @@ _scratch_mkfs_sized()
        esac
 }
 
+_scratch_mkfs_sized()
+{
+       _try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized failed with ($*)"
+}
+
 # Emulate an N-data-disk stripe w/ various stripe units
 # _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize]
 _scratch_mkfs_geom()
index 00a516c3eead9af82fa01022ee78d1c698a83ee8..684f5fdf5f9b5ac934c40c41e8d9cbeffa59a7a4 100755 (executable)
@@ -157,8 +157,7 @@ workout()
        _scratch_unmount >/dev/null 2>&1
        echo "*** mkfs -dsize=$fsz"    >>$seqres.full
        echo ""                                     >>$seqres.full
-       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-               || _fail "size=$fsz mkfs failed"
+       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1
        _scratch_mount
        # -w ensures that the only ops are ones which cause write I/O
        run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \
index 333524e26859a9107ad4c343dddec2465c2ebbaa..5b9a887b58d88c279b31c0e328494fd96bd849af 100755 (executable)
@@ -43,8 +43,7 @@ workout()
        _scratch_unmount >/dev/null 2>&1
        echo "*** mkfs -dsize=$fsz"    >>$seqres.full
        echo ""                                     >>$seqres.full
-       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-               || _fail "size=$fsz mkfs failed"
+       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1
        _scratch_mount "-o noatime"
 
        run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
@@ -70,8 +69,7 @@ workout()
        _scratch_unmount >/dev/null 2>&1
        echo "*** mkfs -dsize=$fsz"    >>$seqres.full
        echo ""                                     >>$seqres.full
-       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-               || _fail "size=$fsz mkfs failed"
+       _scratch_mkfs_sized $fsz >>$seqres.full 2>&1
        _scratch_mount "-o noatime"
 
        _btrfs receive $SCRATCH_MNT < $send_files_dir/base.snap
index a9277abf648a00b018861169354a70acf482ee66..62768c60bb14006051b8a8bcad1883d09dc62b2c 100755 (executable)
@@ -24,7 +24,7 @@ _scratch_unmount
 
 # With 4k block size, this amounts to 10M FS instance.
 fssize=$((2560 * $blocksize))
-_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 
 offset=0
index 4230bde9268150ee2c9887facec450b15a21f3e9..f4864ffc4a21118f35fbe8ade3a2ad1434306533 100755 (executable)
@@ -23,7 +23,7 @@ _require_scratch_size_nocheck $((1024 * 1024))
 # Initalize a 512M ext4 fs with resize_inode feature disabled
 dev_size=$((512 * 1024 * 1024))
 MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \
-       >>$seqres.full 2>&1 || _fail "mkfs failed"
+       >>$seqres.full 2>&1
 
 # Force some reserved GDT blocks to trigger the bug
 $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \
index 10423a29170dcf4cfcd0582d5a6a578d0ae3af97..716a7b1f9449d0ade04b4340f0643270da6c27a7 100755 (executable)
@@ -31,8 +31,7 @@ _require_no_large_scratch_dev
 
 # btrfs needs at least 256MB (with upward round off) to create a non-mixed mode
 # fs. Ref: btrfs-progs: btrfs_min_dev_size()
-_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 \
-    || _fail "mkfs failed"
+_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount
 out=$SCRATCH_MNT/fillup.$$
 
index 94d89faebe5c743202dcb3815fee6dd20446b34e..2624e88f1456b3b34c6aa88e506db0136f8f3571 100755 (executable)
@@ -50,7 +50,7 @@ _scratch_unmount >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seqres.full
 echo ""                                     >>$seqres.full
 fs_size=$((256 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount
 mkdir $SCRATCH_MNT/subdir
 
index 2a5af3ccba8d5de4361907825c24d6b6552f4581..4cd1c39977b5a1680953a83739a1fc0963baba28 100755 (executable)
@@ -50,8 +50,7 @@ workout()
                _scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seqres.full 2>&1 \
                        || _fail "size=$fsz,agcount=$ags mkfs failed"
        else
-               _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-                       || _fail "size=$fsz mkfs failed"
+               _scratch_mkfs_sized $fsz >>$seqres.full 2>&1
        fi
        _scratch_mount
 
index f823a4549d88fbd4aa577d535d86c4a3a97d2d80..fb2a6f14523cc15fb89d71c3078ceefaae5c2015 100755 (executable)
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
        sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
index 383824b986ed90fda86ef64bb20ee5ce9f1f2755..ab5122fa401f517fd71b9117c102d40252237d93 100755 (executable)
@@ -40,7 +40,7 @@ umount $SCRATCH_MNT
 
 file_size=$((768 * 1024 * 1024))
 fs_size=$((1024 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
index e1493278b8f140dba13cfc3337ffb0d00c034fcf..0eb313e27646de9b3bc32196fef754437e417f80 100755 (executable)
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
        sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
index c7a177b8ba8ff2f14b3c588372c9d0076728b39e..1505453e1581cba9daf3a3188fb1d06de7b27bf1 100755 (executable)
@@ -43,7 +43,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
        sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
index 4059c9eacf788a46be1554211748cdf53fc13531..05bfd5012927432a509de8d33e6b7f0981e49f09 100755 (executable)
@@ -30,7 +30,7 @@ for blocksize in 512 1024 2048 4096 8192 16384 32768 65536; do
        _scratch_unmount > /dev/null 2>&1
        # Try to format and mount with the given blocksize.  If they don't
        # succeed, move on to the next block size.
-       if ! _scratch_mkfs_sized $devsize $blocksize >> $seqres.full 2>&1 ||
+       if ! _try_scratch_mkfs_sized $devsize $blocksize >> $seqres.full 2>&1 ||
           ! _try_scratch_mount >> $seqres.full 2>&1 ||
           test "$(stat -f -c '%S' $SCRATCH_MNT)" -ne "$blocksize"; then
                echo "+++ Format and mount failed" >> $seqres.full
index 0ba111a604c0f9a9185c12147e054768971690fa..89107a610a83cab5306b70662b9def0af0703258 100755 (executable)
@@ -25,7 +25,7 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "finsert"
 
 dev_size=$((80 * 1024 * 1024))
-_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
 
 _scratch_mount
 _require_congruent_file_oplen $SCRATCH_MNT 1048576     # finsert at 1M
index a7f4d2436999898b674c24de4b0e6a6ebea5900a..3896ce1c3325454b14a3c7ba72d4050f416dee7e 100755 (executable)
@@ -43,7 +43,7 @@ _scratch_mount
 _require_fs_space $SCRATCH_MNT 196608
 _scratch_unmount
 
-_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw || _fail "mkfs failed"
+_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw
 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
 # get original data blocks number and agcount
 . $tmp.mkfs
index 6af14c802ca920ac35c75efdff6d1a7616d48377..0cf167012c571d1668ce26f75885167bb7346067 100755 (executable)
@@ -51,8 +51,7 @@ echo "Silence is golden."
 sdev=$(_short_dev $SCRATCH_DEV)
 
 # use a small log fs
-_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1 ||
-               _fail "mkfs failed"
+_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1
 _scratch_mount
 
 # populate the fs with some data and cycle the mount to reset the log head/tail