xfs: make sure our default quota warning limits and grace periods survive quotacheck
RFC PATCH 1/1 xfs: make sure our default quota warning limits and grace periods survive quotacheck
From: Darrick J. Wong <[email protected]>
Make sure that the default quota grace period and maximum warning limits set by the administrator survive quotacheck.
---
This is the testcase to go with 'xfs: preserve default grace interval during quotacheck', though Eric and I haven't figured out how we're going to land that one...
--- tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/913.out | 13 ++++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/913 create mode 100644 tests/xfs/913.out
tests/xfs/913 new file +69 -0
@@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 913 +# +# Make sure that the quota default grace period and maximum warning limits +# survive quotacheck. + +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 + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_qmount_option "usrquota" +_scratch_mount >> $seqres.full + +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Run repair to force quota check +_scratch_xfs_repair >> $seqres.full 2>&1 + +# Remount (this time to run quotacheck) and check the limits. There's a bug +# in quotacheck where we would reset the ondisk default grace period to zero +# while the incore copy stays at whatever was read in prior to quotacheck. +# This will show up after the /next/ remount. +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# success, all done +status=0 +exit
tests/xfs/913.out new file +13 -0
@@ -0,0 +1,13 @@ +QA output created by 913 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00]
tests/xfs/group +1 -0
@@ -539,4 +539,5 @@ 910 auto quick inobtcount 911 auto quick bigtime 912 auto quick label +913 auto quick quota 997 auto quick mount
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure that the default quota grace period and maximum warning limits set by the administrator survive quotacheck.
Signed-off-by Darrick J. Wong <[email protected]>---
This is the testcase to go with 'xfs: preserve default grace interval during quotacheck', though Eric and I haven't figured out how we're going to land that one...
This probably could be a generic test, though I don't know how we're supposed to handle the test matrix of all the different versions, types, and applications which can implement or manage quota... I guess since it's an xfs specific fix perhaps an xfs-specific test is reasonable.
Quoted 48 lines
--- tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/913.out | 13 ++++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/913 create mode 100644 tests/xfs/913.outtests/xfs/913 new file +34
-0@@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 913 +# +# Make sure that the quota default grace period and maximum warning limits +# survive quotacheck. + +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 + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota +
tests/xfs/913 line 44
Quoted 10 lines
tests/xfs/913 new file +10
-0+rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_qmount_option "usrquota" +_scratch_mount >> $seqres.full + +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount
ok as long as you're only doing one quota type and it's the user quota type this should survive future changes.
Hm, actually I wonder if it'd be best to explicitly call "state -u" because state_f() does:
if (!type)
type = XFS_USER_QUOTA | XFS_GROUP_QUOTA | XFS_PROJ_QUOTA;and that bitmask'd type(s) gets eventually fed to xfsquotactl -> xtype_to_qtype which really only handles one quota type, not a bitmask, and if more than one is set it gives up and returns zero which magically happens to be XFS_USER_QUOTA. (whee!)
tl;dr: "state -u" might be more deterministic in the long run.
Quoted 55 lines
tests/xfs/913 new file +25
-0+ +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Run repair to force quota check +_scratch_xfs_repair >> $seqres.full 2>&1 + +# Remount (this time to run quotacheck) and check the limits. There's a bug +# in quotacheck where we would reset the ondisk default grace period to zero +# while the incore copy stays at whatever was read in prior to quotacheck. +# This will show up after the /next/ remount. +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# success, all done +status=0 +exittests/xfs/913.out new file +13
-0@@ -0,0 +1,13 @@ +QA output created by 913 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00]tests/xfs/group +1
-0@@ -539,4 +539,5 @@ 910 auto quick inobtcount 911 auto quick bigtime 912 auto quick label +913 auto quick quota 997 auto quick mount
tests/xfs/913
Quoted 19 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure that the default quota grace period and maximum warning limits set by the administrator survive quotacheck.
Signed-off-by Darrick J. Wong <[email protected]>---
This is the testcase to go with 'xfs: preserve default grace interval during quotacheck', though Eric and I haven't figured out how we're going to land that one...--- tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/913.out | 13 ++++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/913 create mode 100644 tests/xfs/913.outtests/xfs/913 +0
-0
Hi,
Can "_require_xfs_quota_foreign" help this case to be a generic case?
Quoted 47 lines
new file mode 100755
index 00000000..94681b02tests/xfs/913 new file +42
-0@@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 913 +# +# Make sure that the quota default grace period and maximum warning limits +# survive quotacheck. + +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 + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_qmount_option "usrquota" +_scratch_mount >> $seqres.full + +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT
tests/xfs/913 line 52
Quoted 10 lines
tests/xfs/913 new file +10
-0+$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Run repair to force quota check +_scratch_xfs_repair >> $seqres.full 2>&1
I've sent a case looks like do similar test as this:
[PATCH 1/2] generic: per-type quota timers set/get test
But it doesn't do fsck before cycle-mount. And ...[below]
tests/xfs/913 line 65
Quoted 13 lines
tests/xfs/913 new file +13
-0+ +# Remount (this time to run quotacheck) and check the limits. There's a bug +# in quotacheck where we would reset the ondisk default grace period to zero +# while the incore copy stays at whatever was read in prior to quotacheck. +# This will show up after the /next/ remount. +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount
It doesn't do twice cycle mount either. Do you think the fsck is necessary? And do you think these two cases can be merged into one case?
Thanks,
Zorro
Quoted 34 lines
tests/xfs/913 new file +4
-0+ +# success, all done +status=0 +exittests/xfs/913.out new file +13
-0@@ -0,0 +1,13 @@ +QA output created by 913 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00]tests/xfs/group +1
-0@@ -539,4 +539,5 @@ 910 auto quick inobtcount 911 auto quick bigtime 912 auto quick label +913 auto quick quota 997 auto quick mount
Quoted 88 lines · Zorro Lang
tests/xfs/913
Quoted 19 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure that the default quota grace period and maximum warning limits set by the administrator survive quotacheck.
Signed-off-by Darrick J. Wong <[email protected]>---
This is the testcase to go with 'xfs: preserve default grace interval during quotacheck', though Eric and I haven't figured out how we're going to land that one...--- tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/913.out | 13 ++++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/913 create mode 100644 tests/xfs/913.outtests/xfs/913 +0
-0Hi,
Can "
_require_xfs_quota_foreign" help this case to be a generic case?Quoted 47 lines
new file mode 100755
index 00000000..94681b02tests/xfs/913 new file +42
-0@@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 913 +# +# Make sure that the quota default grace period and maximum warning limits +# survive quotacheck. + +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 + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_qmount_option "usrquota" +_scratch_mount >> $seqres.full + +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNTtests/xfs/913 line 52
Quoted 10 lines
tests/xfs/913 new file +10
-0+$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Run repair to force quota check +_scratch_xfs_repair >> $seqres.full 2>&1I've sent a case looks like do similar test as this:
[PATCH 1/2] generic: per-type quota timers set/get testBut it doesn't do fsck before cycle-mount. And ...[below]
Quoted 15 lines
tests/xfs/913 line 65
Quoted 13 lines
tests/xfs/913 new file +13
-0+ +# Remount (this time to run quotacheck) and check the limits. There's a bug +# in quotacheck where we would reset the ondisk default grace period to zero +# while the incore copy stays at whatever was read in prior to quotacheck. +# This will show up after the /next/ remount. +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmountIt doesn't do twice cycle mount either. Do you think the fsck is necessary?
This test is looking for a bug in quotacheck, so I use xfs_repair to force a quotacheck.
Quoted 1 line
And do you think these two cases can be merged into one case?
<shrug> Probably. I don't see a problem in having one testcase poke related problems, and it can always come after the bits that are already in the growing pile of quota tests (see the one that Eric sent...)
--D
Quoted 38 lines
Thanks,
ZorroQuoted 34 lines
tests/xfs/913 new file +4
-0+ +# success, all done +status=0 +exittests/xfs/913.out new file +13
-0@@ -0,0 +1,13 @@ +QA output created by 913 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00]tests/xfs/group +1
-0@@ -539,4 +539,5 @@ 910 auto quick inobtcount 911 auto quick bigtime 912 auto quick label +913 auto quick quota 997 auto quick mount
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make sure that the default quota grace period and maximum warning limits set by the administrator survive quotacheck.
Signed-off-by Darrick J. Wong <[email protected]>---
This is the testcase to go with 'xfs: preserve default grace interval during quotacheck', though Eric and I haven't figured out how we're going to land that one...
<it landed>
This looks fine to me and it works. Sorry for derailing it thinking that it didn't work based on a bug in my patch stack. :(
Quoted 113 lines
--- tests/xfs/913 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/913.out | 13 ++++++++++ tests/xfs/group | 1 + 3 files changed, 83 insertions(+) create mode 100755 tests/xfs/913 create mode 100644 tests/xfs/913.outtests/xfs/913 new file +69
-0@@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 913 +# +# Make sure that the quota default grace period and maximum warning limits +# survive quotacheck. + +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 + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota + +rm -f $seqres.full + +# Format filesystem and set up quota limits +_scratch_mkfs > $seqres.full +_qmount_option "usrquota" +_scratch_mount >> $seqres.full + +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Run repair to force quota check +_scratch_xfs_repair >> $seqres.full 2>&1 + +# Remount (this time to run quotacheck) and check the limits. There's a bug +# in quotacheck where we would reset the ondisk default grace period to zero +# while the incore copy stays at whatever was read in prior to quotacheck. +# This will show up after the /next/ remount. +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# Remount and check the limits +_scratch_mount >> $seqres.full +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' +_scratch_unmount + +# success, all done +status=0 +exittests/xfs/913.out new file +13
-0@@ -0,0 +1,13 @@ +QA output created by 913 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00]tests/xfs/group +1
-0@@ -539,4 +539,5 @@ 910 auto quick inobtcount 911 auto quick bigtime 912 auto quick label +913 auto quick quota 997 auto quick mount