2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017, Jeff Layton <jlayton@redhat.com>
7 # Open a file several times, write to it, fsync on all fds and make sure that
8 # they all return 0. Change the device to start throwing errors. Write again
9 # on all fds and fsync on all fds. Ensure that we get errors on all of them.
10 # Then fsync on all one last time and verify that all return 0.
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
24 rm -rf $tmp.* $testdir
28 # get standard environment, filters and checks
33 # real QA test starts here
35 # This test uses "dm" without taking into account the data could be on
36 # realtime subvolume, thus the test will fail with rtinherit=1
39 # Generally, we want to avoid journal errors on the extended testcase. Only
40 # unset the -s flag if we have a logdev
44 _notrun "btrfs has a specialized test for this"
47 # Do the more thorough test if we have a logdev
48 _has_logdev && sflag=''
54 _require_dm_target error
55 _require_test_program fsync-err
56 _require_test_program dmerror
60 echo "Format and mount"
61 _scratch_mkfs > $seqres.full 2>&1
65 _require_fs_space $SCRATCH_MNT 65536
67 testfile=$SCRATCH_MNT/fsync-err-test
69 echo "$here/src/fsync-err $sflag -d $here/src/dmerror $testfile" >> $seqres.full
70 $here/src/fsync-err $sflag -d $here/src/dmerror $testfile
73 _dmerror_load_working_table
77 # fs may be corrupt after this -- attempt to repair it
78 _repair_scratch_fs >> $seqres.full