2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc., All Rights Reserved.
7 # Test I/O on dm error device.
9 # Motivated by an ext4 bug that crashes kernel on error path when trying to
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
33 # remove previous $seqres.full before test
36 # real QA test starts here
39 _require_scratch_nocheck # fs went down with a dirty log, don't check it
40 _require_dm_target error
41 # If SCRATCH_DEV is not a valid block device, FSTYP cannot be mkfs'ed either
42 _require_block_device $SCRATCH_DEV
44 echo "Silence is golden"
46 _scratch_mkfs >>$seqres.full 2>&1
49 # Use strictatime mount option here to force atime updates, which could help
50 # trigger the NULL pointer dereference on ext4 more easily
51 _dmerror_mount "-o strictatime"
52 _dmerror_load_error_table
54 # flush dmerror block device buffers and drop all caches, force reading from
56 blockdev --flushbufs $DMERROR_DEV
57 echo 3 > /proc/sys/vm/drop_caches
60 ls -l $SCRATCH_MNT >>$seqres.full 2>&1
61 $XFS_IO_PROG -fc "pwrite 0 1M" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
63 # no panic no hang, success, all done