2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
8 # Inject an error during rmap update to test log recovery.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
22 _scratch_unmount > /dev/null 2>&1
26 # get standard environment, filters and checks
32 # real QA test starts here
36 _require_scratch_reflink
37 _require_xfs_scratch_rmapbt
38 _require_xfs_io_error_injection "rmap_finish_one"
45 echo "Format filesystem"
46 _scratch_mkfs >/dev/null 2>&1
47 _scratch_mount >> $seqres.full
50 _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
51 $XFS_IO_PROG -f -c "truncate $sz" $SCRATCH_MNT/file3 >> $seqres.full
55 md5sum $SCRATCH_MNT/file1 | _filter_scratch
56 md5sum $SCRATCH_MNT/file3 | _filter_scratch
59 _scratch_inject_error "rmap_finish_one"
62 _reflink_range $SCRATCH_MNT/file1 0 $SCRATCH_MNT/file3 0 $sz >> $seqres.full
64 echo "FS should be shut down, touch will fail"
65 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
67 echo "Remount to replay log"
68 _scratch_inject_logprint >> $seqres.full
71 md5sum $SCRATCH_MNT/file1 | _filter_scratch
72 md5sum $SCRATCH_MNT/file3 | _filter_scratch
74 echo "FS should be online, touch should succeed"
75 touch $SCRATCH_MNT/goodfs