tests: remove udf/101
[xfstests-dev.git] / tests / generic / 338
1 #! /bin/bash
2 # FS QA Test 338
3 #
4 # Test I/O on dm error device.
5 #
6 # Motivated by an ext4 bug that crashes kernel on error path when trying to
7 # update atime.
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2016 Red Hat Inc.,  All Rights Reserved.
11 #
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.
15 #
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.
20 #
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 #-----------------------------------------------------------------------
25 #
26
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
35
36 _cleanup()
37 {
38         cd /
39         rm -f $tmp.*
40         _dmerror_cleanup
41 }
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46 . ./common/dmerror
47
48 # remove previous $seqres.full before test
49 rm -f $seqres.full
50
51 # real QA test starts here
52 _supported_fs generic
53 _supported_os Linux
54 _require_scratch
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
58
59 echo "Silence is golden"
60
61 _scratch_mkfs >>$seqres.full 2>&1
62 _dmerror_init
63
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
68
69 # flush dmerror block device buffers and drop all caches, force reading from
70 # error device
71 blockdev --flushbufs $DMERROR_DEV
72 echo 3 > /proc/sys/vm/drop_caches
73
74 # do some test I/O
75 ls -l $SCRATCH_MNT >>$seqres.full 2>&1
76 $XFS_IO_PROG -fc "pwrite 0 1M" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
77
78 # no panic no hang, success, all done
79 status=0
80 exit