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
48 _supported_fs ext2 ext3 ext4 xfs
52 # Generally, we want to avoid journal errors in this test. Ensure that
53 # journalled fs' have a logdev.
54 if [ "$FSTYP" != "ext2" ]; then
58 _require_dm_target error
59 _require_test_program fsync-err
60 _require_test_program dmerror
64 echo "Format and mount"
65 _scratch_mkfs > $seqres.full 2>&1
69 _require_fs_space $SCRATCH_MNT 65536
71 testfile=$SCRATCH_MNT/fsync-err-test
73 $here/src/fsync-err -d $here/src/dmerror $testfile
76 _dmerror_load_working_table
80 # fs may be corrupt after this -- attempt to repair it
81 _repair_scratch_fs >> $seqres.full