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 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
14 status=1 # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
23 # get standard environment, filters and checks
27 testfile=$TEST_DIR/testfile.$seq
29 # real QA test starts here
34 echo "Silence is golden"
36 block_size=`_get_block_size $TEST_DIR`
38 # On unpatched ext4, if an extent exists which includes the block right
39 # before the maximum file offset, and the block for the maximum file offset
40 # is written, the kernel panics
41 # On patched ext4, the write would get EFBIG since we lower s_maxbytes by
44 # Create a sparse file with an extent lays at one block before old s_maxbytes
45 offset=$(((2**32 - 2) * $block_size))
46 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >$seqres.full 2>&1
48 # Write to the block after the extent just created
49 offset=$(((2**32 - 1) * $block_size))
50 $XFS_IO_PROG -f -c "pwrite $offset $block_size" -c fsync $testfile >>$seqres.full 2>&1
52 # Got here without hitting BUG_ON(), test passed