4 # Runs various rename fsync tests to cover some rename fsync corner cases.
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2013 Fusion IO. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #-----------------------------------------------------------------------
25 seqres=$RESULT_DIR/$seq
26 echo "QA output created by $seq"
29 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
42 # real QA test starts here
54 rm -rf $SCRATCH_MNT/foo $SCRATCH_MNT/bar
58 # Btrfs wasn't making sure the new file after rename survived the fsync
61 echo "fsync rename test"
63 $XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" $SCRATCH_MNT/foo \
64 > $seqres.full 2>&1 || _fail "xfs_io failed"
65 mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
66 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
67 _load_flakey_table $FLAKEY_DROP_WRITES
68 md5sum $SCRATCH_MNT/bar | _filter_scratch
71 _load_flakey_table $FLAKEY_ALLOW_WRITES
73 md5sum $SCRATCH_MNT/bar | _filter_scratch
75 _check_scratch_fs $FLAKEY_DEV
76 [ $? -ne 0 ] && _fatal "fsck failed"
79 # Btrfs was dropping some of the modified extents in between fsyncs if we
81 _write_after_fsync_rename_test()
83 echo "fsync rename test"
85 $XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" -c "pwrite 2M 1M" \
86 -c "sync_range -b" $SCRATCH_MNT/foo > $seqres.full 2>&1 || _fail "xfs_io failed"
87 mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
88 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
89 _load_flakey_table $FLAKEY_DROP_WRITES
90 md5sum $SCRATCH_MNT/bar | _filter_scratch
93 _load_flakey_table $FLAKEY_ALLOW_WRITES
95 md5sum $SCRATCH_MNT/bar | _filter_scratch
99 _scratch_mkfs >> $seqres.full 2>&1
101 # Create a basic flakey device that will never error out
106 _write_after_fsync_rename_test