4 # Open a file several times, write to it, fsync on all fds and make sure that
5 # they all return 0. Change the device to start throwing errors. Write again
6 # on all fds and fsync on all fds. Ensure that we get errors on all of them.
7 # Then fsync on all one last time and verify that all return 0.
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2017, Jeff Layton <jlayton@redhat.com>
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 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
38 rm -rf $tmp.* $testdir
42 # get standard environment, filters and checks
47 # real QA test starts here
50 # This test uses "dm" without taking into account the data could be on
51 # realtime subvolume, thus the test will fail with rtinherit=1
54 # Generally, we want to avoid journal errors on the extended testcase. Only
55 # unset the -s flag if we have a logdev
59 _notrun "btrfs has a specialized test for this"
62 # Do the more thorough test if we have a logdev
63 _has_logdev && sflag=''
69 _require_dm_target error
70 _require_test_program fsync-err
71 _require_test_program dmerror
75 echo "Format and mount"
76 _scratch_mkfs > $seqres.full 2>&1
80 _require_fs_space $SCRATCH_MNT 65536
82 testfile=$SCRATCH_MNT/fsync-err-test
84 echo "$here/src/fsync-err $sflag -d $here/src/dmerror $testfile" >> $seqres.full
85 $here/src/fsync-err $sflag -d $here/src/dmerror $testfile
88 _dmerror_load_working_table
92 # fs may be corrupt after this -- attempt to repair it
93 _repair_scratch_fs >> $seqres.full