generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 312
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 312
6 #
7 # ENOSPC in fallocate(2) could corrupt ext4 when file size > 4G
8 #
9 # Regression test for commit
10 # 29ae07b ext4: Fix overflow caused by missing cast in ext4_fallocate()
11 #
12 . ./common/preamble
13 _begin_fstest auto quick prealloc enospc
14
15 # Import common functions.
16 . ./common/filter
17
18 # real QA test starts here
19 _supported_fs generic
20 _require_xfs_io_command "falloc"
21 _require_scratch
22
23 # 5G in byte
24 fssize=$((2**30 * 5))
25
26 _scratch_mkfs_sized $fssize >>$seqres.full 2>&1
27 _scratch_mount >>$seqres.full 2>&1
28
29 echo "Silence is golden"
30
31 # fallocate(2) a 6G(> 4G) file on a 5G fs
32 $XFS_IO_PROG -f -c "falloc 0 6g" $SCRATCH_MNT/testfile.$seq >>$seqres.full 2>&1
33
34 _scratch_unmount
35 status=0
36 exit