2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
7 # Regression test for commit:
8 # f17722f ext4: Fix max file size and logical block counting of extent format file
11 _begin_fstest auto quick
13 # Override the default cleanup function.
20 # Import common functions.
23 testfile=$TEST_DIR/testfile.$seq
25 # real QA test starts here
29 echo "Silence is golden"
31 block_size=`_get_block_size $TEST_DIR`
33 # On unpatched ext4, if an extent exists which includes the block right
34 # before the maximum file offset, and the block for the maximum file offset
35 # is written, the kernel panics
36 # On patched ext4, the write would get EFBIG since we lower s_maxbytes by
39 # Create a sparse file with an extent lays at one block before old s_maxbytes
40 offset=$(((2**32 - 2) * $block_size))
41 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >$seqres.full 2>&1
43 # Write to the block after the extent just created
44 offset=$(((2**32 - 1) * $block_size))
45 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >>$seqres.full 2>&1
47 # Got here without hitting BUG_ON(), test passed