2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Red Hat, Inc. All Rights Reserved.
7 # Test individual user ID quota grace period extension
8 # This is the linux quota-tools version of the test
10 # This test only exercises user quota because it's not known whether the
11 # filesystem can set individual grace timers for each quota type
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
33 # remove previous $seqres.full before test
36 # real QA test starts here
41 _require_setquota_project
43 _scratch_mkfs >$seqres.full 2>&1
44 _qmount_option "usrquota"
47 echo "Silence is golden"
49 # Set a default user inode grace period of 1 second
50 setquota -t -u 0 1 $SCRATCH_MNT
51 # Soft inode limit 1, hard limit 5
52 setquota -u $qa_user 0 0 1 5 $SCRATCH_MNT
53 # Run qa user over soft limit and go over grace period
54 su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2"
56 # Extend grace to now + 100s
59 setquota -T -u $qa_user 0 100 $SCRATCH_MNT 2>&1 | grep -v "^setquota"
60 get=`repquota -up $SCRATCH_MNT | grep "^$qa_user" | awk '{print $NF}'`
62 # Either the new expiry must match; or be one second after the set time, to
63 # deal with the seconds counter incrementing.
64 if [ "$get" != "$set" ] && [ "$get" -ne "$((set + 1))" ]; then
65 echo "set grace to $set but got grace $get"