@@ -330,12 +330,20 @@ __stress_freeze_filter_output() {
# Filter scrub output so that we don't tarnish the golden output if the fs is
# too busy to scrub. Note: Tests should _notrun if the scrub type is not
-# supported.
+# supported. Callers can provide extra strings to filter out as function
+# arguments.
__stress_scrub_filter_output() {
+ local extra_args=()
+
+ for arg in "$@"; do
+ extra_args+=(-e "/${arg}/d")
+ done
+
_filter_scratch | \
sed -e '/Device or resource busy/d' \
-e '/Optimization possible/d' \
- -e '/No space left on device/d'
+ -e '/No space left on device/d' \
+ "${extra_args[@]}"
}
# Decide if the scratch filesystem is still alive.
@@ -401,13 +409,34 @@ __stress_one_scrub_loop() {
fi
done
+ local extra_filters=()
+ local target_cmd=(echo "$scrub_tgt")
+ case "$scrub_tgt" in
+ "%file%"|"%datafile%"|"%attrfile%")
+ extra_filters+=('No such file or directory' 'No such device or address')
+ target_cmd=(find "$SCRATCH_MNT" -print)
+ ;;
+ "%dir%")
+ extra_filters+=('No such file or directory' 'Not a directory')
+ target_cmd=(find "$SCRATCH_MNT" -type d -print)
+ ;;
+ "%regfile%"|"%cowfile%")
+ extra_filters+=('No such file or directory')
+ target_cmd=(find "$SCRATCH_MNT" -type f -print)
+ ;;
+ esac
+
while __stress_scrub_running "$scrub_startat" "$runningfile"; do
sleep 1
done
while __stress_scrub_running "$end" "$runningfile"; do
- $XFS_IO_PROG -x "${xfs_io_args[@]}" "$scrub_tgt" 2>&1 | \
- __stress_scrub_filter_output
+ readarray -t fnames < <("${target_cmd[@]}" 2>/dev/null)
+ for fname in "${fnames[@]}"; do
+ $XFS_IO_PROG -x "${xfs_io_args[@]}" "$fname" 2>&1 | \
+ __stress_scrub_filter_output "${extra_filters[@]}"
+ __stress_scrub_running "$end" "$runningfile" || break
+ done
done
}
@@ -585,6 +614,22 @@ __stress_scrub_fsstress_loop() {
"default")
# No new arguments
;;
+ "symlink")
+ focus+=('-z')
+
+ # Only create, read, and delete symbolic links
+ focus+=('-f' 'symlink=4')
+ focus+=('-f' 'readlink=10')
+ focus+=('-f' 'unlink=1')
+ ;;
+ "mknod")
+ focus+=('-z')
+
+ # Only create and delete special files
+ focus+=('-f' 'mknod=4')
+ focus+=('-f' 'getdents=100')
+ focus+=('-f' 'unlink=1')
+ ;;
*)
echo "$stress_tgt: Unrecognized stress target, using defaults."
;;
@@ -715,9 +760,31 @@ __stress_scrub_check_commands() {
local scrub_tgt="$1"
shift
+ local cooked_tgt="$scrub_tgt"
+ case "$scrub_tgt" in
+ "%file%"|"%dir%")
+ cooked_tgt="$SCRATCH_MNT"
+ ;;
+ "%regfile%"|"%datafile%")
+ cooked_tgt="$SCRATCH_MNT/testfile"
+ echo test > "$cooked_tgt"
+ ;;
+ "%attrfile%")
+ cooked_tgt="$SCRATCH_MNT/testfile"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 64k' "$cooked_tgt" &>/dev/null
+ attr -s attrname "$cooked_tgt" < "$cooked_tgt" &>/dev/null
+ ;;
+ "%cowfile%")
+ cooked_tgt="$SCRATCH_MNT/testfile"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 128k' "$cooked_tgt" &>/dev/null
+ _cp_reflink "$cooked_tgt" "$cooked_tgt.1"
+ $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1' "$cooked_tgt.1" &>/dev/null
+ ;;
+ esac
+
for arg in "$@"; do
local cooked_arg="$(echo "$arg" | sed -e "s/%agno%/0/g")"
- testio=`$XFS_IO_PROG -x -c "$cooked_arg" $scrub_tgt 2>&1`
+ testio=`$XFS_IO_PROG -x -c "$cooked_arg" "$cooked_tgt" 2>&1`
echo $testio | grep -q "Unknown type" && \
_notrun "xfs_io scrub subcommand support is missing"
echo $testio | grep -q "Inappropriate ioctl" && \
@@ -749,6 +816,16 @@ __stress_scrub_check_commands() {
# -S Pass this option to xfs_scrub. If zero -S options are specified,
# xfs_scrub will not be run. To select repair mode, pass '-k' or '-v'.
# -t Run online scrub against this file; $SCRATCH_MNT is the default.
+# Special values are as follows:
+#
+# %file% all files
+# %regfile% regular files
+# %dir% direct
+# %datafile% regular files with data blocks
+# %attrfile% regular files with xattr blocks
+# %cowfile% regular files with shared blocks
+#
+# File selection races with fsstress, so the selection is best-effort.
# -w Delay the start of the scrub/repair loop by this number of seconds.
# Defaults to no delay unless XFS_SCRUB_STRESS_DELAY is set. This value
# will be clamped to ten seconds before the end time.
@@ -758,6 +835,8 @@ __stress_scrub_check_commands() {
# 'xattr': Grow extended attributes in a small tree.
# 'default': Run fsstress with default arguments.
# 'writeonly': Only perform fs updates, no reads.
+# 'symlink': Only create symbolic links.
+# 'mknod': Only create special files.
#
# The default is 'default' unless XFS_SCRUB_STRESS_TARGET is set.
# -X Run this program to exercise the filesystem. Currently supported
new file mode 100755
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 792
+#
+# Race fsstress and inode record scrub for a while to see if we crash or
+# livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_scrub -s "scrub inode" -t "%file%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 792
+Silence is golden
new file mode 100755
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 793
+#
+# Race fsstress and data fork scrub for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_scrub -s "scrub bmapbtd" -t "%datafile%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 793
+Silence is golden
new file mode 100755
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 794
+#
+# Race fsstress and attr fork scrub for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+. ./common/attr
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_attrs
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_scrub -x 'xattr' -s "scrub bmapbta" -t "%attrfile%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 794
+Silence is golden
new file mode 100755
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 795
+#
+# Race fsstress and cow fork scrub for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+. ./common/reflink
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_require_xfs_has_feature "$SCRATCH_MNT" reflink
+_scratch_xfs_stress_scrub -s "scrub bmapbtc" -t "%cowfile%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 795
+Silence is golden
new file mode 100755
@@ -0,0 +1,37 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 796
+#
+# Race fsstress and directory scrub for a while to see if we crash or livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_scrub -x 'dir' -s "scrub directory" -t "%dir%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 796
+Silence is golden
new file mode 100755
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 797
+#
+# Race fsstress and extended attributes scrub for a while to see if we crash or
+# livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+. ./common/attr
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_attrs
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_scrub -x 'xattr' -s "scrub xattr" -t "%attrfile%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 797
+Silence is golden
new file mode 100755
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 799
+#
+# Race fsstress and parent pointers scrub for a while to see if we crash or
+# livelock.
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+_scratch_xfs_stress_scrub -s "scrub parent" -t "%dir%"
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 799
+Silence is golden
new file mode 100755
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 826
+#
+# Race fsstress and symlink scrub for a while to see if we crash or livelock.
+# We can't open symlink files directly for scrubbing, so we use xfs_scrub(8).
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+XFS_SCRUB_PHASE=3 _scratch_xfs_stress_scrub -x 'symlink' -S '-n'
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 826
+Silence is golden
new file mode 100755
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. Inc. All Rights Reserved.
+#
+# FS QA Test No. 827
+#
+# Race fsstress and special file scrub for a while to see if we crash or
+# livelock. We can't open special files directly for scrubbing, so we use
+# xfs_scrub(8).
+#
+. ./common/preamble
+_begin_fstest scrub dangerous_fsstress_scrub
+
+_cleanup() {
+ _scratch_xfs_stress_scrub_cleanup &> /dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+_register_cleanup "_cleanup" BUS
+
+# Import common functions.
+. ./common/filter
+. ./common/fuzzy
+. ./common/inject
+. ./common/xfs
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch
+_require_xfs_stress_scrub
+
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+XFS_SCRUB_PHASE=3 _scratch_xfs_stress_scrub -x 'mknod' -S '-n'
+
+# success, all done
+echo Silence is golden
+status=0
+exit
new file mode 100644
@@ -0,0 +1,2 @@
+QA output created by 827
+Silence is golden