xfs: test fixes for new 5.17 behaviors
[xfstests-dev.git] / common / xfs
index d7f2a0054d4652929bf6b769233e4d0317229761..713e9fe78de998a70715a75580aa5d1784349016 100644 (file)
@@ -595,10 +595,14 @@ _check_xfs_filesystem()
                ok=0
        fi
 
-       # xfs_check runs out of memory on large files, so even providing the test
-       # option (-t) to avoid indexing the free space trees doesn't make it pass on
-       # large filesystems. Avoid it.
-       if [ "$LARGE_SCRATCH_DEV" != yes ]; then
+       # xfs_check runs out of memory on large files, so even providing the
+       # test option (-t) to avoid indexing the free space trees doesn't make
+       # it pass on large filesystems. Avoid it.
+       #
+       # As of August 2021, xfs_repair completely supersedes xfs_check's
+       # ability to find corruptions, so we no longer run xfs_check unless
+       # forced to run it.
+       if [ "$LARGE_SCRATCH_DEV" != yes ] && [ "$FORCE_XFS_CHECK_PROG" = "yes" ]; then
                _xfs_check $extra_log_options $device 2>&1 > $tmp.fs_check
        fi
        if [ -s $tmp.fs_check ]; then
@@ -772,6 +776,18 @@ _reset_xfs_sysfs_error_handling()
        done
 }
 
+# Unmount an XFS with a dirty log
+_scratch_xfs_unmount_dirty()
+{
+       local f="$SCRATCH_MNT/.dirty_umount"
+
+       rm -f "$f"
+       echo "test" > "$f"
+       sync
+       _scratch_shutdown
+       _scratch_unmount
+}
+
 # Skip if we are running an older binary without the stricter input checks.
 # Make multiple checks to be sure that there is no regression on the one
 # selected feature check, which would skew the result.
@@ -820,7 +836,8 @@ _require_scratch_xfs_shrink()
        . $tmp.mkfs
        _scratch_mount
        # here just to check if kernel supports, no need do more extra work
-       local errmsg=$($XFS_GROWFS_PROG -D$((dblocks-1)) "$SCRATCH_MNT" 2>&1)
+       local errmsg
+       errmsg=$($XFS_GROWFS_PROG -D$((dblocks-1)) "$SCRATCH_MNT" 2>&1)
        if [ "$?" -ne 0 ]; then
                echo "$errmsg" | grep 'XFS_IOC_FSGROWFSDATA xfsctl failed: Invalid argument' > /dev/null && \
                        _notrun "kernel does not support shrinking"