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 _begin_fstest auto quick clone
13 # Override the default cleanup function.
17 _scratch_unmount > /dev/null 2>&1
21 # Import common functions.
26 # real QA test starts here
29 _require_scratch_reflink
30 _require_xfs_io_error_injection "bmap_finish_one"
35 echo "Format filesystem"
36 _scratch_mkfs >/dev/null 2>&1
37 _scratch_mount >> $seqres.full
40 _pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
41 _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2
42 _pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file3 >> $seqres.full
46 md5sum $SCRATCH_MNT/file1 | _filter_scratch
47 md5sum $SCRATCH_MNT/file2 | _filter_scratch
48 md5sum $SCRATCH_MNT/file3 | _filter_scratch
51 _scratch_inject_error "bmap_finish_one"
54 _reflink_range $SCRATCH_MNT/file1 0 $SCRATCH_MNT/file3 0 $sz >> $seqres.full
56 echo "FS should be shut down, touch will fail"
57 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
59 echo "Remount to replay log"
60 _scratch_inject_logprint >> $seqres.full
62 echo "FS should be online, touch should succeed"
63 touch $SCRATCH_MNT/goodfs