2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 IBM Corporation. All Rights Reserved.
7 # Check if fallocate respects RLIMIT_FSIZE
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
17 sysctl -w kernel.core_pattern="$core_pattern" &>/dev/null
23 status=1 # failure is the default!
24 trap "_cleanup; exit \$status" 0 1 2 3 15 25
26 # get standard environment, filters and checks
29 # real QA test starts here
30 # generic, but xfs_io's fallocate must work
32 # only Linux supports fallocate
35 [ -n "$XFS_IO_PROG" ] || _notrun "xfs_io executable not found"
39 # Sanity check to see if fallocate works
40 _require_xfs_io_command "falloc"
42 # Check if we have good enough space available
43 avail=`df -P $TEST_DIR | awk 'END {print $4}'`
44 [ "$avail" -ge 104000 ] || _notrun "Test device is too small ($avail KiB)"
46 # Suppress core dumped messages
47 core_pattern=`sysctl -n kernel.core_pattern`
49 sysctl -w kernel.core_pattern=core &>/dev/null
52 # Set the FSIZE ulimit to 100MB and check
55 [ "$flim" != "unlimited" ] || _notrun "Unable to set FSIZE ulimit"
56 [ "$flim" -eq 102400 ] || _notrun "FSIZE ulimit is not correct (100 MB)"
58 echo "File size limit is now set to 100 MB."
59 echo "Let us try to preallocate 101 MB. This should fail."
60 $XFS_IO_PROG -f -c 'falloc 0 101m' $TEST_DIR/ouch
63 echo "Let us now try to preallocate 50 MB. This should succeed."
64 $XFS_IO_PROG -f -c 'falloc 0 50m' $TEST_DIR/ouch