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 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
21 _scratch_unmount > /dev/null 2>&1
25 # get standard environment, filters and checks
30 # real QA test starts here
33 _require_xfs_scratch_rmapbt
34 _require_error_injection
35 _require_xfs_io_error_injection "rmap_finish_one"
42 echo "Format filesystem"
43 _scratch_mkfs >/dev/null 2>&1
44 _scratch_mount >> $seqres.full
47 touch $SCRATCH_MNT/file1
48 _pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file0 >> $seqres.full
52 md5sum $SCRATCH_MNT/file0 | _filter_scratch
53 md5sum $SCRATCH_MNT/file1 | _filter_scratch
56 _scratch_inject_error "rmap_finish_one"
59 $XFS_IO_PROG -c "pwrite -W -S 0x67 -b $sz 0 $sz" $SCRATCH_MNT/file1 >> $seqres.full 2>&1
61 echo "FS should be shut down, touch will fail"
62 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
64 echo "Remount to replay log"
65 _scratch_inject_logprint >> $seqres.full
68 md5sum $SCRATCH_MNT/file0 | _filter_scratch
69 md5sum $SCRATCH_MNT/file1 | _filter_scratch
71 echo "FS should be online, touch should succeed"
72 touch $SCRATCH_MNT/goodfs