4 # Test I/O on dm error device.
6 # Motivated by an ext4 bug that crashes kernel on error path when trying to
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2016 Red Hat Inc., All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
48 # remove previous $seqres.full before test
51 # real QA test starts here
55 _require_dm_target error
56 # If SCRATCH_DEV is not a valid block device, FSTYP cannot be mkfs'ed either
57 _require_block_device $SCRATCH_DEV
59 echo "Silence is golden"
61 _scratch_mkfs >>$seqres.full 2>&1
64 # Use strictatime mount option here to force atime updates, which could help
65 # trigger the NULL pointer dereference on ext4 more easily
66 _dmerror_mount "-o strictatime"
67 _dmerror_load_error_table
69 # flush dmerror block device buffers and drop all caches, force reading from
71 blockdev --flushbufs $DMERROR_DEV
72 echo 3 > /proc/sys/vm/drop_caches
75 ls -l $SCRATCH_MNT >>$seqres.full 2>&1
76 $XFS_IO_PROG -fc "pwrite 0 1M" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
78 # no panic no hang, success, all done