2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Fusion IO. All Rights Reserved.
7 # Runs various rename fsync tests to cover some rename fsync corner cases.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
14 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
22 # get standard environment, filters and checks
27 # real QA test starts here
29 _require_scratch_nocheck
30 _require_dm_target flakey
37 rm -rf $SCRATCH_MNT/foo $SCRATCH_MNT/bar
41 # Btrfs wasn't making sure the new file after rename survived the fsync
44 echo "fsync rename test"
46 $XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" $SCRATCH_MNT/foo \
48 mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
49 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
50 md5sum $SCRATCH_MNT/bar | _filter_scratch
52 _flakey_drop_and_remount
54 md5sum $SCRATCH_MNT/bar | _filter_scratch
56 _check_scratch_fs $FLAKEY_DEV
57 [ $? -ne 0 ] && _fatal "fsck failed"
60 # Btrfs was dropping some of the modified extents in between fsyncs if we
62 _write_after_fsync_rename_test()
64 echo "fsync rename test"
66 $XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" -c "pwrite 2M 1M" \
67 -c "sync_range -b 2M 1M" $SCRATCH_MNT/foo >> $seqres.full 2>&1
68 mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
69 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
70 md5sum $SCRATCH_MNT/bar | _filter_scratch
72 _flakey_drop_and_remount
74 md5sum $SCRATCH_MNT/bar | _filter_scratch
78 _scratch_mkfs >> $seqres.full 2>&1
79 _require_metadata_journaling $SCRATCH_DEV
81 # Create a basic flakey device that will never error out
86 _write_after_fsync_rename_test