2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Simulate rmap update errors with a file write and a file remove.
10 _begin_fstest auto quick rmap
12 # Override the default cleanup function.
16 _scratch_unmount > /dev/null 2>&1
20 # Import common functions.
24 # real QA test starts here
27 _require_xfs_scratch_rmapbt
28 _require_error_injection
29 _require_xfs_io_error_injection "rmap_finish_one"
34 echo "Format filesystem"
35 _scratch_mkfs >/dev/null 2>&1
36 _scratch_mount >> $seqres.full
39 touch $SCRATCH_MNT/file1
40 _pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file0 >> $seqres.full
44 md5sum $SCRATCH_MNT/file0 | _filter_scratch
45 md5sum $SCRATCH_MNT/file1 | _filter_scratch
48 _scratch_inject_error "rmap_finish_one"
51 $XFS_IO_PROG -c "pwrite -W -S 0x67 -b $sz 0 $sz" $SCRATCH_MNT/file1 >> $seqres.full 2>&1
53 echo "FS should be shut down, touch will fail"
54 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
56 echo "Remount to replay log"
57 _scratch_remount_dump_log >> $seqres.full
60 md5sum $SCRATCH_MNT/file0 | _filter_scratch
61 md5sum $SCRATCH_MNT/file1 | _filter_scratch
63 echo "FS should be online, touch should succeed"
64 touch $SCRATCH_MNT/goodfs