2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
8 # Inject an error during block remap 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
35 _require_scratch_reflink
36 _require_xfs_io_error_injection "bmap_finish_one"
42 sz=$((blksz * blks - 17))
43 echo "Format filesystem"
44 _scratch_mkfs >/dev/null 2>&1
45 _scratch_mount >> $seqres.full
48 _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
49 _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2
53 md5sum $SCRATCH_MNT/file1 | _filter_scratch
54 md5sum $SCRATCH_MNT/file2 | _filter_scratch
57 _scratch_inject_error "bmap_finish_one"
60 _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3 2>&1 | _filter_scratch
62 echo "FS should be shut down, touch will fail"
63 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
65 echo "Remount to replay log"
66 _scratch_inject_logprint >> $seqres.full
69 md5sum $SCRATCH_MNT/file1 | _filter_scratch
70 md5sum $SCRATCH_MNT/file2 | _filter_scratch
71 md5sum $SCRATCH_MNT/file3 | _filter_scratch
73 echo "FS should be online, touch should succeed"
74 touch $SCRATCH_MNT/goodfs