4 # Test remount on I/O errors.
6 # XFS had a bug to hang on remount in this case, this kernel commit fix
8 # 5cb13dc cancel the setfilesize transation when io error happen
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
40 _destroy_loop_device $loop_dev
45 # get standard environment, filters and checks
51 # real QA test starts here
55 _require_block_device $SCRATCH_DEV
57 # create a small filesystem to hold another filesystem image
58 _scratch_mkfs_sized $((512 * 1024 * 1024)) >>$seqres.full 2>&1
61 # create the sparse fs image and mount point
62 fs_img=$SCRATCH_MNT/fs.img
63 fs_mnt=$SCRATCH_MNT/mnt
64 $XFS_IO_PROG -fc "truncate 1g" $fs_img >>$seqres.full 2>&1
67 # mount loop device and create a larger file to hit I/O errors on loop device
68 loop_dev=$(_create_loop_device $fs_img)
70 _mount $loop_dev $fs_mnt
71 $XFS_IO_PROG -fc "pwrite 0 520m" $fs_mnt/testfile >>$seqres.full 2>&1
73 # remount should not hang
74 $MOUNT_PROG -o remount,ro $fs_mnt >>$seqres.full 2>&1
77 echo "Silence is golden"