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 _begin_fstest auto quick rw
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_error_injection
28 _require_xfs_io_error_injection "rmap_finish_one"
33 echo "Format filesystem"
34 _scratch_mkfs >/dev/null 2>&1
35 _scratch_mount >> $seqres.full
37 # This test depends on specific behaviors of the data device, so create all
39 _xfs_force_bdev data $SCRATCH_MNT
42 touch $SCRATCH_MNT/file1
45 $XFS_IO_PROG -c "pwrite -S 0x67 0 $sz" $SCRATCH_MNT/file1 >> $seqres.full
49 md5sum $SCRATCH_MNT/file1 2>&1 | _filter_scratch
52 _scratch_inject_error "free_extent"
55 rm -rf $SCRATCH_MNT/file1
57 $XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
59 echo "FS should be shut down, touch will fail"
60 touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
62 echo "Remount to replay log"
63 _scratch_inject_logprint >> $seqres.full
66 md5sum $SCRATCH_MNT/file1 2>&1 | _filter_scratch
68 echo "FS should be online, touch should succeed"
69 touch $SCRATCH_MNT/goodfs