diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-02-14 12:16:41 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-05-10 17:20:20 -0700 |
commit | b8febd902afdc1b47489ffe7556788b01e42066e (patch) | |
tree | d1151951ff4b7672ab907305b471bc02b11caec3 | |
parent | 3bd8f646e3b3db669e298dcd2c5c0e4360d1e6c0 (diff) | |
download | xfstests-dev-health-monitoring.tar.gz |
xfs: test io error reporting via healthmonhealth-monitoring_2024-05-10health-monitoring
Create a new test to make sure the kernel can report IO errors via
health monitoring.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rwxr-xr-x | tests/xfs/1878 | 77 | ||||
-rw-r--r-- | tests/xfs/1878.out | 10 |
2 files changed, 87 insertions, 0 deletions
diff --git a/tests/xfs/1878 b/tests/xfs/1878 new file mode 100755 index 0000000000..fe7a1411b7 --- /dev/null +++ b/tests/xfs/1878 @@ -0,0 +1,77 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1878 +# +# Attempt to read and write a file in buffered and directio mode with the +# health monitoring program running. Check that healthmon observes all four +# types of IO errors. +# +. ./common/preamble +_begin_fstest auto quick eio + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir + _dmerror_cleanup +} + +# Import common functions. +. ./common/filter +. ./common/dmerror + +# real QA test starts here +_require_scratch_nocheck +_require_xfs_io_command healthmon +_require_dm_target error + +# Disable the scratch rt device to avoid test failures relating to the rt +# bitmap consuming all the free space in our small data device. +unset SCRATCH_RTDEV + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_dmerror_init no_log +_dmerror_mount + +_require_fs_space $SCRATCH_MNT 65536 + +testfile=$SCRATCH_MNT/fsync-err-test +$XFS_IO_PROG -f -c 'pwrite -b 1m 0 1m' -c fsync $testfile >> $seqres.full + +# First we check if directio errors get reported +$XFS_IO_PROG -c 'healthmon -c -v' $SCRATCH_MNT >> $tmp.healthmon & +sleep 1 # wait for python program to start up +_dmerror_load_error_table +$XFS_IO_PROG -d -c 'pwrite -b 256k 12k 16k' $testfile >> $seqres.full +$XFS_IO_PROG -d -c 'pread -b 256k 48k 16k' $testfile >> $seqres.full +_dmerror_load_working_table + +_dmerror_unmount +wait # for healthmon to finish +_dmerror_mount + +# Next we check if buffered io errors get reported. We have to write something +# before loading the error table to ensure the dquots get loaded. +$XFS_IO_PROG -c 'pwrite -b 256k 1023k 1k' -c fsync $testfile >> $seqres.full +$XFS_IO_PROG -c 'healthmon -c -v' $SCRATCH_MNT >> $tmp.healthmon & +sleep 1 # wait for python program to start up +_dmerror_load_error_table +$XFS_IO_PROG -c 'pread -b 256k 12k 16k' $testfile >> $seqres.full +$XFS_IO_PROG -c 'pwrite -b 256k 48k 16k' -c fsync $testfile >> $seqres.full +_dmerror_load_working_table + +_dmerror_unmount +wait # for healthmon to finish + +# Did we get errors? +cat $tmp.healthmon >> $seqres.full +grep -E '(diowrite|dioread|readahead|writeback)' $tmp.healthmon | sort | uniq + +_dmerror_cleanup + +status=0 +exit diff --git a/tests/xfs/1878.out b/tests/xfs/1878.out new file mode 100644 index 0000000000..a8070c3c1a --- /dev/null +++ b/tests/xfs/1878.out @@ -0,0 +1,10 @@ +QA output created by 1878 +Format and mount +pwrite: Input/output error +pread: Input/output error +pread: Input/output error +fsync: Input/output error + "type": "dioread", + "type": "diowrite", + "type": "readahead", + "type": "writeback", |