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
39 _require_block_device $SCRATCH_DEV
42 # create a small filesystem to hold another filesystem image
43 _scratch_mkfs_sized $((512 * 1024 * 1024)) >>$seqres.full 2>&1
46 # create the sparse fs image and mount point
47 fs_img=$SCRATCH_MNT/fs.img
48 fs_mnt=$SCRATCH_MNT/mnt
49 $XFS_IO_PROG -fc "truncate 1g" $fs_img >>$seqres.full 2>&1
52 # mount loop device and create a larger file to hit I/O errors on loop device
53 loop_dev=$(_create_loop_device $fs_img)
55 _mount $loop_dev $fs_mnt
56 if [ "$FSTYP" = "xfs" ]; then
57 # Turn off all XFS metadata IO error retries
58 dname=$(_short_dev $loop_dev)
59 echo 0 | tee /sys/fs/xfs/$dname/error/*/*/* > /dev/null
61 $XFS_IO_PROG -fc "pwrite 0 520m" $fs_mnt/testfile >>$seqres.full 2>&1
63 # remount should not hang
64 $MOUNT_PROG -o remount,ro $fs_mnt >>$seqres.full 2>&1
67 echo "Silence is golden"