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 _begin_fstest auto quick
16 # Override the default cleanup function.
20 _destroy_loop_device $loop_dev
25 # Import common functions.
28 # real QA test starts here
31 _require_block_device $SCRATCH_DEV
34 # create a small filesystem to hold another filesystem image
35 _scratch_mkfs_sized $((512 * 1024 * 1024)) >>$seqres.full 2>&1
38 # create the sparse fs image and mount point
39 fs_img=$SCRATCH_MNT/fs.img
40 fs_mnt=$SCRATCH_MNT/mnt
41 $XFS_IO_PROG -fc "truncate 1g" $fs_img >>$seqres.full 2>&1
44 # mount loop device and create a larger file to hit I/O errors on loop device
45 loop_dev=$(_create_loop_device $fs_img)
47 _mount $loop_dev $fs_mnt
48 if [ "$FSTYP" = "xfs" ]; then
49 # Turn off all XFS metadata IO error retries
50 dname=$(_short_dev $loop_dev)
51 echo 0 | tee /sys/fs/xfs/$dname/error/*/*/* > /dev/null
53 $XFS_IO_PROG -fc "pwrite 0 520m" $fs_mnt/testfile >>$seqres.full 2>&1
55 # remount should not hang
56 $MOUNT_PROG -o remount,ro $fs_mnt >>$seqres.full 2>&1
59 echo "Silence is golden"