2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
7 # Test remount on I/O errors.
9 # XFS had a bug to hang on remount in this case, this kernel commit fix
11 # 5cb13dc cancel the setfilesize transation when io error happen
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
25 _destroy_loop_device $loop_dev
30 # get standard environment, filters and checks
36 # real QA test starts here
40 _require_block_device $SCRATCH_DEV
43 # create a small filesystem to hold another filesystem image
44 _scratch_mkfs_sized $((512 * 1024 * 1024)) >>$seqres.full 2>&1
47 # create the sparse fs image and mount point
48 fs_img=$SCRATCH_MNT/fs.img
49 fs_mnt=$SCRATCH_MNT/mnt
50 $XFS_IO_PROG -fc "truncate 1g" $fs_img >>$seqres.full 2>&1
53 # mount loop device and create a larger file to hit I/O errors on loop device
54 loop_dev=$(_create_loop_device $fs_img)
56 _mount $loop_dev $fs_mnt
57 if [ "$FSTYP" = "xfs" ]; then
58 # Turn off all XFS metadata IO error retries
59 dname=$(_short_dev $loop_dev)
60 echo 0 | tee /sys/fs/xfs/$dname/error/*/*/* > /dev/null
62 $XFS_IO_PROG -fc "pwrite 0 520m" $fs_mnt/testfile >>$seqres.full 2>&1
64 # remount should not hang
65 $MOUNT_PROG -o remount,ro $fs_mnt >>$seqres.full 2>&1
68 echo "Silence is golden"