xfs: fix old fuzz test invocations of xfs_repair
[xfstests-dev.git] / tests / xfs / 519
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 519
6 #
7 # Make sure that reflink forces the log out if we mount with wsync.  We test
8 # that it actually forced the log by immediately shutting down the fs without
9 # flushing the log and then remounting to check file contents.
10
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1    # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29 . ./common/reflink
30
31 # real QA test starts here
32 _supported_fs xfs
33 _require_scratch_reflink
34 _require_cp_reflink
35
36 rm -f $seqres.full
37
38 # Format filesystem and set up quota limits
39 _scratch_mkfs > $seqres.full
40 _scratch_mount -o wsync >> $seqres.full
41
42 # Set up initial files
43 $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m -b 1m' $SCRATCH_MNT/a >> $seqres.full
44 $XFS_IO_PROG -f -c 'pwrite -S 0x59 0 1m -b 1m' $SCRATCH_MNT/c >> $seqres.full
45 _cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/e
46 _cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d
47 touch $SCRATCH_MNT/b
48 sync
49
50 # Test that setting the reflink flag on the dest file forces the log
51 echo "test reflink flag not set"
52 $XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" -c 'shutdown' $SCRATCH_MNT/b >> $seqres.full
53 _scratch_cycle_mount wsync
54 md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch
55
56 # Test forcing the log even if both files are already reflinked
57 echo "test reflink flag already set"
58 $XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" -c 'shutdown' $SCRATCH_MNT/d >> $seqres.full
59 _scratch_cycle_mount wsync
60 md5sum $SCRATCH_MNT/a $SCRATCH_MNT/d | _filter_scratch
61
62 # success, all done
63 status=0
64 exit