]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fuzzy: test the scrub stress subcommands before looping
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Dec 2022 22:12:54 +0000 (14:12 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 14 Jan 2023 13:49:35 +0000 (21:49 +0800)
Before we commit to running fsstress and scrub commands in a loop for
some time, we should check that the provided commands actually work on
the scratch filesystem.  The _require_xfs_io_command predicate only
detects the presence of the scrub ioctl, not any particular subcommand.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/fuzzy

index 88ba5fef698123dc7abc7008965f7ab105563871..8d3e30e32bbe6c3d10ee38628c62b0aaf9341542 100644 (file)
@@ -405,6 +405,25 @@ _scratch_xfs_stress_scrub_cleanup() {
        $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
 }
 
+# Make sure the provided scrub/repair commands actually work on the scratch
+# filesystem before we start running them in a loop.
+__stress_scrub_check_commands() {
+       local scrub_tgt="$1"
+       shift
+
+       for arg in "$@"; do
+               testio=`$XFS_IO_PROG -x -c "$arg" $scrub_tgt 2>&1`
+               echo $testio | grep -q "Unknown type" && \
+                       _notrun "xfs_io scrub subcommand support is missing"
+               echo $testio | grep -q "Inappropriate ioctl" && \
+                       _notrun "kernel scrub ioctl is missing"
+               echo $testio | grep -q "No such file or directory" && \
+                       _notrun "kernel does not know about: $arg"
+               echo $testio | grep -q "Operation not supported" && \
+                       _notrun "kernel does not support: $arg"
+       done
+}
+
 # Start scrub, freeze, and fsstress in background looping processes, and wait
 # for 30*TIME_FACTOR seconds to see if the filesystem goes down.  Callers
 # must call _scratch_xfs_stress_scrub_cleanup from their cleanup functions.
@@ -427,6 +446,8 @@ _scratch_xfs_stress_scrub() {
                esac
        done
 
+       __stress_scrub_check_commands "$scrub_tgt" "${one_scrub_args[@]}"
+
        local start="$(date +%s)"
        local end="$((start + (30 * TIME_FACTOR) ))"