* [PATCH 1/2] generic: per-type quota timers set/get test @ 2020-02-16 18:16 Zorro Lang 2020-02-16 18:16 ` [PATCH 2/2] generic: test per-type quota softlimit enforcement timeout Zorro Lang ` (3 more replies) 0 siblings, 4 replies; 9+ messages in thread From: Zorro Lang @ 2020-02-16 18:16 UTC (permalink / raw) To: fstests; +Cc: linux-xfs Set different grace time, make sure each of quota (user, group and project) timers can be set (by setquota) and get (by repquota) correctly. Signed-off-by: Zorro Lang <zlang@redhat.com> --- Hi, This case test passed on ext4, but on XFS (xfs-linux for-next branch with Eric's patchset: [PATCH 0/4] xfs: enable per-type quota timers and warn limits) I got below different output: # diff -u tests/generic/593.out results/generic/593.out.bad --- tests/generic/593.out 2020-02-15 12:08:49.012651926 -0500 +++ results//generic/593.out.bad 2020-02-16 13:00:58.811815870 -0500 @@ -5,28 +5,28 @@ *** Report for group quotas on device SCRATCH_DEV Block grace time: 7days; Inode grace time: 7days *** Report for project quotas on device SCRATCH_DEV -Block grace time: 00:10; Inode grace time: 00:20 +Block grace time: 7days; Inode grace time: 7days 2. set group quota timer *** Report for user quotas on device SCRATCH_DEV Block grace time: 7days; Inode grace time: 7days *** Report for group quotas on device SCRATCH_DEV -Block grace time: 00:30; Inode grace time: 00:40 +Block grace time: 7days; Inode grace time: 7days *** Report for project quotas on device SCRATCH_DEV -Block grace time: 00:10; Inode grace time: 00:20 +Block grace time: 7days; Inode grace time: 7days 3. set user quota timer *** Report for user quotas on device SCRATCH_DEV Block grace time: 00:50; Inode grace time: 01:00 *** Report for group quotas on device SCRATCH_DEV -Block grace time: 00:30; Inode grace time: 00:40 +Block grace time: 00:50; Inode grace time: 01:00 *** Report for project quotas on device SCRATCH_DEV -Block grace time: 00:10; Inode grace time: 00:20 +Block grace time: 00:50; Inode grace time: 01:00 4. cycle mount *** Report for user quotas on device SCRATCH_DEV Block grace time: 00:50; Inode grace time: 01:00 *** Report for group quotas on device SCRATCH_DEV -Block grace time: 00:30; Inode grace time: 00:40 +Block grace time: 00:50; Inode grace time: 01:00 *** Report for project quotas on device SCRATCH_DEV -Block grace time: 00:10; Inode grace time: 00:20 +Block grace time: 00:50; Inode grace time: 01:00 This looks like totally wrong, can anyone help to take a look at it? Thanks, Zorro tests/generic/593 | 69 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/593.out | 32 ++++++++++++++++++++ tests/generic/group | 1 + 3 files changed, 102 insertions(+) create mode 100755 tests/generic/593 create mode 100644 tests/generic/593.out diff --git a/tests/generic/593 b/tests/generic/593 new file mode 100755 index 00000000..fd695329 --- /dev/null +++ b/tests/generic/593 @@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 593 +# +# Test per-type(user, group and project) filesystem quota timers, make sure +# each of grace time can be set/get properly. +# +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 + +_scratch_mkfs >$seqres.full 2>&1 +_scratch_enable_pquota +_qmount_option "usrquota,grpquota,prjquota" +_qmount +_require_prjquota $SCRATCH_DEV + +MIN=60 + +echo "1. set project quota timer" +setquota -t -P $((10 * MIN)) $((20 * MIN)) $SCRATCH_MNT +repquota -ugP $SCRATCH_MNT | grep "Report\|^Block" | _filter_scratch +echo + +echo "2. set group quota timer" +setquota -t -g $((30 * MIN)) $((40 * MIN)) $SCRATCH_MNT +repquota -ugP $SCRATCH_MNT | grep "Report\|^Block" | _filter_scratch +echo + +echo "3. set user quota timer" +setquota -t -u $((50 * MIN)) $((60 * MIN)) $SCRATCH_MNT +repquota -ugP $SCRATCH_MNT | grep "Report\|^Block" | _filter_scratch +echo + +# cycle mount, make sure the quota timers are still right +echo "4. cycle mount" +_qmount +repquota -ugP $SCRATCH_MNT | grep "Report\|^Block" | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/593.out b/tests/generic/593.out new file mode 100644 index 00000000..71dfa224 --- /dev/null +++ b/tests/generic/593.out @@ -0,0 +1,32 @@ +QA output created by 593 +1. set project quota timer +*** Report for user quotas on device SCRATCH_DEV +Block grace time: 7days; Inode grace time: 7days +*** Report for group quotas on device SCRATCH_DEV +Block grace time: 7days; Inode grace time: 7days +*** Report for project quotas on device SCRATCH_DEV +Block grace time: 00:10; Inode grace time: 00:20 + +2. set group quota timer +*** Report for user quotas on device SCRATCH_DEV +Block grace time: 7days; Inode grace time: 7days +*** Report for group quotas on device SCRATCH_DEV +Block grace time: 00:30; Inode grace time: 00:40 +*** Report for project quotas on device SCRATCH_DEV +Block grace time: 00:10; Inode grace time: 00:20 + +3. set user quota timer +*** Report for user quotas on device SCRATCH_DEV +Block grace time: 00:50; Inode grace time: 01:00 +*** Report for group quotas on device SCRATCH_DEV +Block grace time: 00:30; Inode grace time: 00:40 +*** Report for project quotas on device SCRATCH_DEV +Block grace time: 00:10; Inode grace time: 00:20 + +4. cycle mount +*** Report for user quotas on device SCRATCH_DEV +Block grace time: 00:50; Inode grace time: 01:00 +*** Report for group quotas on device SCRATCH_DEV +Block grace time: 00:30; Inode grace time: 00:40 +*** Report for project quotas on device SCRATCH_DEV +Block grace time: 00:10; Inode grace time: 00:20 diff --git a/tests/generic/group b/tests/generic/group index 6fe62505..637ae325 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -595,3 +595,4 @@ 590 auto prealloc preallocrw 591 auto quick rw pipe splice 592 auto quick encrypt +593 auto quick quota -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] generic: test per-type quota softlimit enforcement timeout 2020-02-16 18:16 [PATCH 1/2] generic: per-type quota timers set/get test Zorro Lang @ 2020-02-16 18:16 ` Zorro Lang 2020-02-18 21:09 ` [PATCH 1/2] generic: per-type quota timers set/get test Eric Sandeen ` (2 subsequent siblings) 3 siblings, 0 replies; 9+ messages in thread From: Zorro Lang @ 2020-02-16 18:16 UTC (permalink / raw) To: fstests; +Cc: linux-xfs Set different block & inode grace timers for user, group and project quotas, then test softlimit enforcement timeout, make sure different grace timers as expected. Signed-off-by: Zorro Lang <zlang@redhat.com> --- Hi, This case test passed on ext4, but on XFS (xfs-linux for-next branch with Eric's patchset: [PATCH 0/4] xfs: enable per-type quota timers and warn limits) I got below different output: # diff -u tests/generic/594.out results/generic/594.out.bad --- /home/git/xfstests-zlang/tests/generic/594.out 2020-02-16 12:46:33.525450453 -0500 +++ /home/git/xfstests-zlang/results//generic/594.out.bad 2020-02-16 12:49:21.297296515 -0500 @@ -10,6 +10,8 @@ pwrite: Disk quota exceeded --- Test inode quota --- Create 2 more files, over the inode softlimit... +touch: cannot touch 'SCRATCH_MNT/file3': Disk quota exceeded +touch: cannot touch 'SCRATCH_MNT/file4': Disk quota exceeded Try to create one more inode after grace... touch: cannot touch 'SCRATCH_MNT/file5': Disk quota exceeded ### Remove all files @@ -20,7 +22,7 @@ Write 225 blocks... Rewrite 250 blocks plus 1 byte, over the block softlimit... Try to write 1 one more block after grace... -pwrite: Disk quota exceeded +pwrite: No space left on device --- Test inode quota --- Create 2 more files, over the inode softlimit... Try to create one more inode after grace... @@ -33,7 +35,7 @@ Write 225 blocks... Rewrite 250 blocks plus 1 byte, over the block softlimit... Try to write 1 one more block after grace... -pwrite: Disk quota exceeded +pwrite: No space left on device --- Test inode quota --- Create 2 more files, over the inode softlimit... Try to create one more inode after grace... That looks weird for me, does anyone know if it's a XFS bug, or how can I fix this issue for xfs? Thanks, Zorro common/quota | 4 + tests/generic/594 | 179 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/594.out | 41 ++++++++++ tests/generic/group | 1 + 4 files changed, 225 insertions(+) create mode 100755 tests/generic/594 create mode 100644 tests/generic/594.out diff --git a/common/quota b/common/quota index 4e07fef1..6450df34 100644 --- a/common/quota +++ b/common/quota @@ -208,6 +208,10 @@ _qmount() if [ "$FSTYP" != "xfs" ]; then quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1 quotaon -ug $SCRATCH_MNT >>$seqres.full 2>&1 + # try to turn on project quota if it's supported + if quotaon --help 2>&1 | grep -q '\-\-project'; then + quotaon --project $SCRATCH_MNT >>$seqres.full 2>&1 + fi fi chmod ugo+rwx $SCRATCH_MNT } diff --git a/tests/generic/594 b/tests/generic/594 new file mode 100755 index 00000000..9a33ab8b --- /dev/null +++ b/tests/generic/594 @@ -0,0 +1,179 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 594 +# +# Test per-type(user, group and project) filesystem quota timers, make sure +# enforcement +# +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() +{ + restore_project + 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 + +require_project() +{ + rm -f $tmp.projects $tmp.projid + if [ -f /etc/projects ];then + cat /etc/projects > $tmp.projects + fi + if [ -f /etc/projid ];then + cat /etc/projid > $tmp.projid + fi + + cat >/etc/projects <<EOF +100:$SCRATCH_MNT/t +EOF + cat >/etc/projid <<EOF +$qa_user:100 +EOF + PROJECT_CHANGED=1 +} + +restore_project() +{ + if [ "$PROJECT_CHANGED" = "1" ];then + rm -f /etc/projects /etc/projid + if [ -f $tmp.projects ];then + cat $tmp.projects > /etc/projects + fi + if [ -f $tmp.projid ];then + cat $tmp.projid > /etc/projid + fi + fi +} + +init_files() +{ + local dir=$1 + + echo "### Initialize files, and their mode and ownership" + touch $dir/file{1,2} 2>/dev/null + chown $qa_user $dir/file{1,2} 2>/dev/null + chgrp $qa_user $dir/file{1,2} 2>/dev/null + chmod 777 $dir 2>/dev/null +} + +cleanup_files() +{ + echo "### Remove all files" + rm -f ${1}/file{1,2,3,4,5,6} +} + +test_grace() +{ + local type=$1 + local dir=$2 + local bgrace=$3 + local igrace=$4 + + init_files $dir + echo "--- Test block quota ---" + # Firstly fit below block soft limit + echo "Write 225 blocks..." + su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((225 * $BLOCK_SIZE))' \ + -c fsync $dir/file1" 2>&1 >>$seqres.full | \ + _filter_xfs_io_error | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + # Secondly overcome block soft limit + echo "Rewrite 250 blocks plus 1 byte, over the block softlimit..." + su $qa_user -c "$XFS_IO_PROG -c 'pwrite 0 $((250 * $BLOCK_SIZE + 1))' \ + -c fsync $dir/file1" 2>&1 >>$seqres.full | \ + _filter_xfs_io_error | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + # Reset grace time here, make below grace time test more accurate + setquota -$type $qa_user -T $bgrace $igrace $SCRATCH_MNT 2>/dev/null + # Now sleep enough grace time and check that softlimit got enforced + sleep $((bgrace + 1)) + echo "Try to write 1 one more block after grace..." + su $qa_user -c "$XFS_IO_PROG -c 'truncate 0' -c 'pwrite 0 $BLOCK_SIZE' \ + $dir/file2" 2>&1 >>$seqres.full | _filter_xfs_io_error | \ + tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + echo "--- Test inode quota ---" + # And now the softlimit test for inodes + # First reset space limits so that we don't have problems with + # space reservations on XFS + setquota -$type $qa_user 0 0 3 100 $SCRATCH_MNT + echo "Create 2 more files, over the inode softlimit..." + su $qa_user -c "touch $dir/file3 $dir/file4" 2>&1 >>$seqres.full | \ + _filter_scratch | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + # Reset grace time here, make below grace time test more accurate + setquota -$type $qa_user -T $bgrace $igrace $SCRATCH_MNT 2>/dev/null + # Wait and check grace time enforcement + sleep $((igrace+1)) + echo "Try to create one more inode after grace..." + su $qa_user -c "touch $dir/file5" 2>&1 >>$seqres.full | + _filter_scratch | tee -a $seqres.full + repquota -v -$type $SCRATCH_MNT | grep -v "^root" >>$seqres.full 2>&1 + cleanup_files $dir +} + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_quota +_require_user +_require_group + +_scratch_mkfs >$seqres.full 2>&1 +_scratch_enable_pquota +_qmount_option "usrquota,grpquota,prjquota" +_qmount +_require_prjquota $SCRATCH_DEV +BLOCK_SIZE=$(_get_file_block_size $SCRATCH_MNT) +rm -rf $SCRATCH_MNT/t +mkdir $SCRATCH_MNT/t +$XFS_IO_PROG -r -c "chproj 100" -c "chattr +P" $SCRATCH_MNT/t +require_project + +echo "### Set up different grace timers to each type of quota" +UBGRACE=12 +UIGRACE=10 +GBGRACE=4 +GIGRACE=2 +PBGRACE=8 +PIGRACE=6 + +setquota -u $qa_user $((250 * $BLOCK_SIZE / 1024)) \ + $((1000 * $BLOCK_SIZE / 1024)) 3 100 $SCRATCH_MNT +setquota -u -t $UBGRACE $UIGRACE $SCRATCH_MNT +setquota -g $qa_user $((250 * $BLOCK_SIZE / 1024)) \ + $((1000 * $BLOCK_SIZE / 1024)) 3 100 $SCRATCH_MNT +setquota -g -t $GBGRACE $GIGRACE $SCRATCH_MNT +setquota -P $qa_user $((250 * $BLOCK_SIZE / 1024)) \ + $((1000 * $BLOCK_SIZE / 1024)) 3 100 $SCRATCH_MNT +setquota -P -t $PBGRACE $PIGRACE $SCRATCH_MNT + +echo; echo "### Test user quota softlimit and grace time" +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE +echo; echo "### Test group quota softlimit and grace time" +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE +echo; echo "### Test project quota softlimit and grace time" +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE + +# success, all done +status=0 +exit diff --git a/tests/generic/594.out b/tests/generic/594.out new file mode 100644 index 00000000..f48948d4 --- /dev/null +++ b/tests/generic/594.out @@ -0,0 +1,41 @@ +QA output created by 594 +### Set up different grace timers to each type of quota + +### Test user quota softlimit and grace time +### Initialize files, and their mode and ownership +--- Test block quota --- +Write 225 blocks... +Rewrite 250 blocks plus 1 byte, over the block softlimit... +Try to write 1 one more block after grace... +pwrite: Disk quota exceeded +--- Test inode quota --- +Create 2 more files, over the inode softlimit... +Try to create one more inode after grace... +touch: cannot touch 'SCRATCH_MNT/file5': Disk quota exceeded +### Remove all files + +### Test group quota softlimit and grace time +### Initialize files, and their mode and ownership +--- Test block quota --- +Write 225 blocks... +Rewrite 250 blocks plus 1 byte, over the block softlimit... +Try to write 1 one more block after grace... +pwrite: Disk quota exceeded +--- Test inode quota --- +Create 2 more files, over the inode softlimit... +Try to create one more inode after grace... +touch: cannot touch 'SCRATCH_MNT/file5': Disk quota exceeded +### Remove all files + +### Test project quota softlimit and grace time +### Initialize files, and their mode and ownership +--- Test block quota --- +Write 225 blocks... +Rewrite 250 blocks plus 1 byte, over the block softlimit... +Try to write 1 one more block after grace... +pwrite: Disk quota exceeded +--- Test inode quota --- +Create 2 more files, over the inode softlimit... +Try to create one more inode after grace... +touch: cannot touch 'SCRATCH_MNT/t/file5': Disk quota exceeded +### Remove all files diff --git a/tests/generic/group b/tests/generic/group index 637ae325..fc7ae4cd 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -596,3 +596,4 @@ 591 auto quick rw pipe splice 592 auto quick encrypt 593 auto quick quota +594 auto quick quota -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] generic: per-type quota timers set/get test 2020-02-16 18:16 [PATCH 1/2] generic: per-type quota timers set/get test Zorro Lang 2020-02-16 18:16 ` [PATCH 2/2] generic: test per-type quota softlimit enforcement timeout Zorro Lang @ 2020-02-18 21:09 ` Eric Sandeen 2020-02-18 21:41 ` Eric Sandeen 2020-02-20 2:57 ` Eric Sandeen 3 siblings, 0 replies; 9+ messages in thread From: Eric Sandeen @ 2020-02-18 21:09 UTC (permalink / raw) To: Zorro Lang, fstests; +Cc: linux-xfs On 2/16/20 12:16 PM, Zorro Lang wrote: > +echo "1. set project quota timer" > +setquota -t -P $((10 * MIN)) $((20 * MIN)) $SCRATCH_MNT > +repquota -ugP $SCRATCH_MNT | grep "Report\|^Block" | _filter_scratch > +echo FWIW, one thing I notice is that older repquota does not support the "-P" (project) argument. Might need to check for that and _notrun, or something. -Eric ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] generic: per-type quota timers set/get test 2020-02-16 18:16 [PATCH 1/2] generic: per-type quota timers set/get test Zorro Lang 2020-02-16 18:16 ` [PATCH 2/2] generic: test per-type quota softlimit enforcement timeout Zorro Lang 2020-02-18 21:09 ` [PATCH 1/2] generic: per-type quota timers set/get test Eric Sandeen @ 2020-02-18 21:41 ` Eric Sandeen 2020-02-18 21:44 ` Eric Sandeen 2020-02-20 2:57 ` Eric Sandeen 3 siblings, 1 reply; 9+ messages in thread From: Eric Sandeen @ 2020-02-18 21:41 UTC (permalink / raw) To: Zorro Lang, fstests; +Cc: linux-xfs On 2/16/20 12:16 PM, Zorro Lang wrote: > Set different grace time, make sure each of quota (user, group and > project) timers can be set (by setquota) and get (by repquota) > correctly. > > Signed-off-by: Zorro Lang <zlang@redhat.com> > --- > > Hi, > > This case test passed on ext4, but on XFS (xfs-linux for-next branch with > Eric's patchset: [PATCH 0/4] xfs: enable per-type quota timers and warn limits) > I got below different output: *sigh* I wish we didn't have so many different quota tools & interfaces. Behold: # export MIN=60 # setquota -t -g $((30 * MIN)) $((40 * MIN)) /mnt/scratch # ./repquota -g /mnt/scratch *** Report for group quotas on device /dev/pmem0p2 Block grace time: 00:00; Inode grace time: 00:00 ... # xfs_quota -x -c "state -g" /mnt/scratch Group quota state on /mnt/scratch (/dev/pmem0p2) Accounting: ON Enforcement: ON Inode: #132 (1 blocks, 1 extents) Blocks grace time: [0 days 00:30:00] Inodes grace time: [0 days 00:40:00] Realtime Blocks grace time: [--------] seems like this may actually be a bug in the quota/repquota code, trying to dig through that now. repquota actually calls & gets group quota grace, but perhaps it gets overwritten with the subsequent call for the (empty) user quota: # strace -v -e quotactl ./repquota -g /mnt/scratch 2>&1 | grep "STAT|" quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 quotactl(Q_XGETQSTAT|GRPQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=1800, itimelimit=2400, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 quotactl(Q_XGETQSTAT|PRJQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 but why doesn't this happen for ext4 ... -Eric ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] generic: per-type quota timers set/get test 2020-02-18 21:41 ` Eric Sandeen @ 2020-02-18 21:44 ` Eric Sandeen 2020-02-18 22:02 ` Eric Sandeen 0 siblings, 1 reply; 9+ messages in thread From: Eric Sandeen @ 2020-02-18 21:44 UTC (permalink / raw) To: Zorro Lang, fstests; +Cc: linux-xfs On 2/18/20 3:41 PM, Eric Sandeen wrote: > On 2/16/20 12:16 PM, Zorro Lang wrote: >> Set different grace time, make sure each of quota (user, group and >> project) timers can be set (by setquota) and get (by repquota) >> correctly. >> >> Signed-off-by: Zorro Lang <zlang@redhat.com> >> --- >> >> Hi, >> >> This case test passed on ext4, but on XFS (xfs-linux for-next branch with >> Eric's patchset: [PATCH 0/4] xfs: enable per-type quota timers and warn limits) >> I got below different output: > > *sigh* I wish we didn't have so many different quota tools & interfaces. > > Behold: > > # export MIN=60 > # setquota -t -g $((30 * MIN)) $((40 * MIN)) /mnt/scratch > > > # ./repquota -g /mnt/scratch > *** Report for group quotas on device /dev/pmem0p2 > Block grace time: 00:00; Inode grace time: 00:00 > ... > > > # xfs_quota -x -c "state -g" /mnt/scratch > Group quota state on /mnt/scratch (/dev/pmem0p2) > Accounting: ON > Enforcement: ON > Inode: #132 (1 blocks, 1 extents) > Blocks grace time: [0 days 00:30:00] > Inodes grace time: [0 days 00:40:00] > Realtime Blocks grace time: [--------] > > seems like this may actually be a bug in the quota/repquota code, trying to dig through > that now. > > repquota actually calls & gets group quota grace, but perhaps it gets overwritten with the subsequent call for the (empty) user quota: > > # strace -v -e quotactl ./repquota -g /mnt/scratch 2>&1 | grep "STAT|" > quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 > quotactl(Q_XGETQSTAT|GRPQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=1800, itimelimit=2400, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 > quotactl(Q_XGETQSTAT|PRJQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 > quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 > > but why doesn't this happen for ext4 ... ... because on ext4, it makes different quotactl calls... of course :( : quotactl(Q_GETINFO|GRPQUOTA, "/dev/pmem0p2", 0, {bgrace=1800, igrace=2400, flags=0, valid=IIF_BGRACE|IIF_IGRACE|IIF_FLAGS}) = 0 -Eric ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] generic: per-type quota timers set/get test 2020-02-18 21:44 ` Eric Sandeen @ 2020-02-18 22:02 ` Eric Sandeen 0 siblings, 0 replies; 9+ messages in thread From: Eric Sandeen @ 2020-02-18 22:02 UTC (permalink / raw) To: Zorro Lang, fstests; +Cc: linux-xfs On 2/18/20 3:44 PM, Eric Sandeen wrote: > > > On 2/18/20 3:41 PM, Eric Sandeen wrote: >> On 2/16/20 12:16 PM, Zorro Lang wrote: >>> Set different grace time, make sure each of quota (user, group and >>> project) timers can be set (by setquota) and get (by repquota) >>> correctly. >>> >>> Signed-off-by: Zorro Lang <zlang@redhat.com> >>> --- >>> >>> Hi, >>> >>> This case test passed on ext4, but on XFS (xfs-linux for-next branch with >>> Eric's patchset: [PATCH 0/4] xfs: enable per-type quota timers and warn limits) >>> I got below different output: >> >> *sigh* I wish we didn't have so many different quota tools & interfaces. >> >> Behold: >> >> # export MIN=60 >> # setquota -t -g $((30 * MIN)) $((40 * MIN)) /mnt/scratch >> >> >> # ./repquota -g /mnt/scratch >> *** Report for group quotas on device /dev/pmem0p2 >> Block grace time: 00:00; Inode grace time: 00:00 >> ... >> >> >> # xfs_quota -x -c "state -g" /mnt/scratch >> Group quota state on /mnt/scratch (/dev/pmem0p2) >> Accounting: ON >> Enforcement: ON >> Inode: #132 (1 blocks, 1 extents) >> Blocks grace time: [0 days 00:30:00] >> Inodes grace time: [0 days 00:40:00] >> Realtime Blocks grace time: [--------] >> >> seems like this may actually be a bug in the quota/repquota code, trying to dig through >> that now. >> >> repquota actually calls & gets group quota grace, but perhaps it gets overwritten with the subsequent call for the (empty) user quota: >> >> # strace -v -e quotactl ./repquota -g /mnt/scratch 2>&1 | grep "STAT|" >> quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 >> quotactl(Q_XGETQSTAT|GRPQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=1800, itimelimit=2400, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 >> quotactl(Q_XGETQSTAT|PRJQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 >> quotactl(Q_XGETQSTAT|USRQUOTA, "/dev/pmem0p2", 0, {version=1, flags=XFS_QUOTA_UDQ_ACCT|XFS_QUOTA_UDQ_ENFD|XFS_QUOTA_GDQ_ACCT|XFS_QUOTA_GDQ_ENFD, incoredqs=60, u_ino=131, u_nblks=1, u_nextents=1, g_ino=132, g_nblks=1, g_nextents=1, btimelimit=0, itimelimit=0, rtbtimelimit=0, bwarnlimit=0, iwarnlimit=0}) = 0 >> >> but why doesn't this happen for ext4 ... > > ... because on ext4, it makes different quotactl calls... of course :( : > > quotactl(Q_GETINFO|GRPQUOTA, "/dev/pmem0p2", 0, {bgrace=1800, igrace=2400, flags=0, valid=IIF_BGRACE|IIF_IGRACE|IIF_FLAGS}) = 0 Ok, repquota only ever inits the quota info for this purpose with type 0 (i.e. usrquota) I guess this fixes it: diff --git a/quotaio_xfs.c b/quotaio_xfs.c index 56daf89..b22c7b4 100644 --- a/quotaio_xfs.c +++ b/quotaio_xfs.c @@ -81,7 +81,7 @@ static int xfs_init_io(struct quota_handle *h) struct xfs_mem_dqinfo info; int qcmd; - qcmd = QCMD(Q_XFS_GETQSTAT, 0); + qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type); memset(&info, 0, sizeof(struct xfs_mem_dqinfo)); if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0) return -1; and I need to see what's going on here, but probably this too: diff --git a/quotaon_xfs.c b/quotaon_xfs.c index d557a75..d137240 100644 --- a/quotaon_xfs.c +++ b/quotaon_xfs.c @@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r if (flags & STATEFLAG_ALL) return 0; /* noop */ - if (quotactl(QCMD(Q_XFS_GETQSTAT, 0), dev, 0, (void *)&info) < 0) { + if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) { errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno)); return -1; } ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] generic: per-type quota timers set/get test 2020-02-16 18:16 [PATCH 1/2] generic: per-type quota timers set/get test Zorro Lang ` (2 preceding siblings ...) 2020-02-18 21:41 ` Eric Sandeen @ 2020-02-20 2:57 ` Eric Sandeen 2020-02-20 4:15 ` Zorro Lang 3 siblings, 1 reply; 9+ messages in thread From: Eric Sandeen @ 2020-02-20 2:57 UTC (permalink / raw) To: Zorro Lang, fstests; +Cc: linux-xfs On 2/16/20 12:16 PM, Zorro Lang wrote: > --- /dev/null > +++ b/tests/generic/593.out > @@ -0,0 +1,32 @@ > +QA output created by 593 > +1. set project quota timer > +*** Report for user quotas on device SCRATCH_DEV > +Block grace time: 7days; Inode grace time: 7days > +*** Report for group quotas on device SCRATCH_DEV > +Block grace time: 7days; Inode grace time: 7days > +*** Report for project quotas on device SCRATCH_DEV > +Block grace time: 00:10; Inode grace time: 00:20 One other thing that might be an issue here, I'm not sure every filesystem will default to 7 days if no other grace period is set ...? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] generic: per-type quota timers set/get test 2020-02-20 2:57 ` Eric Sandeen @ 2020-02-20 4:15 ` Zorro Lang [not found] ` <605d6c45-9f52-ec84-df01-d5b7665d16dc@sandeen.net> 0 siblings, 1 reply; 9+ messages in thread From: Zorro Lang @ 2020-02-20 4:15 UTC (permalink / raw) To: Eric Sandeen; +Cc: fstests, linux-xfs On Wed, Feb 19, 2020 at 08:57:58PM -0600, Eric Sandeen wrote: > On 2/16/20 12:16 PM, Zorro Lang wrote: > > --- /dev/null > > +++ b/tests/generic/593.out > > @@ -0,0 +1,32 @@ > > +QA output created by 593 > > +1. set project quota timer > > +*** Report for user quotas on device SCRATCH_DEV > > +Block grace time: 7days; Inode grace time: 7days > > +*** Report for group quotas on device SCRATCH_DEV > > +Block grace time: 7days; Inode grace time: 7days > > +*** Report for project quotas on device SCRATCH_DEV > > +Block grace time: 00:10; Inode grace time: 00:20 > > One other thing that might be an issue here, I'm not sure every > filesystem will default to 7 days if no other grace period is set ...? Make sense:) I just hope to test the default grace time by pass. How about: 1) Get the default quota timer $string. 2) Filter above default timer "$string" to "default". to avoid defferent default timer breaks the golden output. Thanks, Zorro > ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <605d6c45-9f52-ec84-df01-d5b7665d16dc@sandeen.net>]
* Re: [PATCH 1/2] generic: per-type quota timers set/get test [not found] ` <605d6c45-9f52-ec84-df01-d5b7665d16dc@sandeen.net> @ 2020-02-20 5:05 ` Zorro Lang 0 siblings, 0 replies; 9+ messages in thread From: Zorro Lang @ 2020-02-20 5:05 UTC (permalink / raw) To: Eric Sandeen; +Cc: fstests, linux-xfs On Wed, Feb 19, 2020 at 10:23:29PM -0600, Eric Sandeen wrote: > > > On 2/19/20 10:15 PM, Zorro Lang wrote: > > On Wed, Feb 19, 2020 at 08:57:58PM -0600, Eric Sandeen wrote: > >> On 2/16/20 12:16 PM, Zorro Lang wrote: > >>> --- /dev/null > >>> +++ b/tests/generic/593.out > >>> @@ -0,0 +1,32 @@ > >>> +QA output created by 593 > >>> +1. set project quota timer > >>> +*** Report for user quotas on device SCRATCH_DEV > >>> +Block grace time: 7days; Inode grace time: 7days > >>> +*** Report for group quotas on device SCRATCH_DEV > >>> +Block grace time: 7days; Inode grace time: 7days > >>> +*** Report for project quotas on device SCRATCH_DEV > >>> +Block grace time: 00:10; Inode grace time: 00:20 > >> > >> One other thing that might be an issue here, I'm not sure every > >> filesystem will default to 7 days if no other grace period is set ...? > > > > Make sense:) I just hope to test the default grace time by pass. > > How about: > > 1) Get the default quota timer $string. > > 2) Filter above default timer "$string" to "default". > > to avoid defferent default timer breaks the golden output. > > Makes sense to me, at least after I fix the other xfs bugs ;) Yeah, I just reviewed your patch: [PATCH] xfs: test that default grace periods init on first mount I think my case hard to cover this situation, I have to filter the default value, but if the default value is bad from beginning, it can't help :) Thanks, Zorro > > -Eric > ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-02-20 4:55 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-02-16 18:16 [PATCH 1/2] generic: per-type quota timers set/get test Zorro Lang 2020-02-16 18:16 ` [PATCH 2/2] generic: test per-type quota softlimit enforcement timeout Zorro Lang 2020-02-18 21:09 ` [PATCH 1/2] generic: per-type quota timers set/get test Eric Sandeen 2020-02-18 21:41 ` Eric Sandeen 2020-02-18 21:44 ` Eric Sandeen 2020-02-18 22:02 ` Eric Sandeen 2020-02-20 2:57 ` Eric Sandeen 2020-02-20 4:15 ` Zorro Lang [not found] ` <605d6c45-9f52-ec84-df01-d5b7665d16dc@sandeen.net> 2020-02-20 5:05 ` Zorro Lang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).