4 # Regression test for commit:
5 # f17722f ext4: Fix max file size and logical block counting of extent format file
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
29 status=1 # failure is the default!
30 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
42 testfile=$TEST_DIR/testfile.$seq
44 # real QA test starts here
50 echo "Silence is golden"
52 block_size=`stat -f -c %s $TEST_DIR`
54 # On unpatched ext4, if an extent exists which includes the block right
55 # before the maximum file offset, and the block for the maximum file offset
56 # is written, the kernel panics
57 # On patched ext4, the write would get EFBIG since we lower s_maxbytes by
60 # Create a sparse file with an extent lays at one block before old s_maxbytes
61 offset=$(((2**32 - 2) * $block_size))
62 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >$seqres.full 2>&1
64 # Write to the block after the extent just created
65 offset=$(((2**32 - 1) * $block_size))
66 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >>$seqres.full 2>&1
68 # Got here without hitting BUG_ON(), test passed