Message ID | 20200216181631.22560-1-zlang@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] generic: per-type quota timers set/get test | expand |
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
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
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
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; }
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 ...?
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 >
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 >
--- 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
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