2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Simulate free extent 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
34 _require_error_injection
35 _require_xfs_io_error_injection "rmap_finish_one"
43 echo "Format filesystem"
44 _scratch_mkfs >/dev/null 2>&1
45 _scratch_mount >> $seqres.full
48 touch $SCRATCH_MNT/file1
51 $XFS_IO_PROG -c "pwrite -S 0x67 0 $sz" $SCRATCH_MNT/file1 >> $seqres.full
55 md5sum $SCRATCH_MNT/file1 2>&1 | _filter_scratch
58 _scratch_inject_error "free_extent"
61 rm -rf $SCRATCH_MNT/file1
63 $XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
65 echo "FS should be shut down, touch will fail"
66 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
68 echo "Remount to replay log"
69 _scratch_inject_logprint >> $seqres.full
72 md5sum $SCRATCH_MNT/file1 2>&1 | _filter_scratch
74 echo "FS should be online, touch should succeed"
75 touch $SCRATCH_MNT/goodfs