2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
7 # Run fsstress and ENSPC hitters in parallel, check quota and
8 # fs consistency an the end
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19 # get standard environment, filters and checks
24 # Disable all sync operations to get higher load
25 FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
33 out=$SCRATCH_MNT/fsstress.$$
34 args=`_scale_fsstress_args -p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out`
35 echo "fsstress $args" >> $seqres.full
36 # Grant chown capability
37 cp $FSSTRESS_PROG $tmp.fsstress.bin
38 $SETCAP_PROG cap_chown=epi $tmp.fsstress.bin
40 # io_uring accounts memory it needs under the rlimit memlocked option,
41 # which can be quite low on some setups (especially 64K pagesize). root
42 # isn't under this restriction, but regular users are. To avoid the
43 # io_uring_queue_init fail on ENOMEM, set max locked memory to unlimited
46 (su $qa_user -c "$tmp.fsstress.bin $args" &) > /dev/null 2>&1
48 echo "Run dd writers in parallel"
49 for ((i=0; i < num_iterations; i++))
51 # File will be opened with O_TRUNC each time
52 su $qa_user -c "dd if=/dev/zero \
53 of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M " \
58 $KILLALL_PROG -w $tmp.fsstress.bin
61 # real QA test starts here
66 _require_command "$KILLALL_PROG" killall
67 _require_command "$SETCAP_PROG" setcap
70 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
71 _scratch_mount "-o usrquota,grpquota"
72 chmod 777 $SCRATCH_MNT
73 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
74 quotaon -u -g $SCRATCH_MNT 2>/dev/null
77 _scratch_unmount 2>/dev/null
81 if ! _check_quota_usage; then
82 _scratch_unmount 2>/dev/null
87 echo Comparing filesystem consistency
88 if ! _scratch_unmount; then
89 echo "failed to umount"