From: Eric Sandeen Date: Mon, 18 May 2020 20:00:36 +0000 (-0500) Subject: fstests: individual user grace period extension via setquota X-Git-Tag: v2022.05.01~779 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5eca07298f5ae11e06a1c2d9d851447a3ef69f22;p=xfstests-dev.git fstests: individual user grace period extension via setquota Test that we can extend an individual user's grace time once they reach their soft limit. [Eryu: add "Silence is golden" output] Signed-off-by: Eric Sandeen Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/tests/generic/600 b/tests/generic/600 new file mode 100755 index 00000000..7ea0d6c2 --- /dev/null +++ b/tests/generic/600 @@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 600 +# +# Test individual user ID quota grace period extension +# This is the linux quota-tools version of the test +# +# This test only exercises user quota because it's not known whether the +# filesystem can set individual grace timers for each quota type +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_quota +_require_user +_require_setquota_project + +_scratch_mkfs >$seqres.full 2>&1 +_qmount_option "usrquota" +_qmount + +echo "Silence is golden" + +# Set a default user inode grace period of 1 second +setquota -t -u 0 1 $SCRATCH_MNT +# Soft inode limit 1, hard limit 5 +setquota -u $qa_user 0 0 1 5 $SCRATCH_MNT +# Run qa user over soft limit and go over grace period +su $qa_user -c "touch $SCRATCH_MNT/file1 $SCRATCH_MNT/file2" +sleep 3 +# Extend grace to now + 100s +now=`date +%s` +let set=now+100 +setquota -T -u $qa_user 0 100 $SCRATCH_MNT 2>&1 | grep -v "^setquota" +get=`repquota -up $SCRATCH_MNT | grep "^$qa_user" | awk '{print $NF}'` + +if [ "$get" != "$set" ]; then + echo "set grace to $set but got grace $get" +fi + +# success, all done +status=0 +exit diff --git a/tests/generic/600.out b/tests/generic/600.out new file mode 100644 index 00000000..f1a959cf --- /dev/null +++ b/tests/generic/600.out @@ -0,0 +1,2 @@ +QA output created by 600 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index 134a2ce0..feeb4b4f 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -602,3 +602,4 @@ 597 auto quick perms 598 auto quick perms 599 auto quick remount shutdown +600 auto quick quota