fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] fstests: more quota related tests
       [not found] <ea649599-f8a9-deb9-726e-329939befade@redhat.com>
@ 2020-05-18 19:59 ` Eric Sandeen
  2020-05-18 19:59   ` [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck Eric Sandeen
                     ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Eric Sandeen @ 2020-05-18 19:59 UTC (permalink / raw)
  To: linux-xfs, fstests

This collects zorro's outstanding patch to test per-type quota
timers, as well as one test from darrick to test limit survival
after quotacheck,  plus 2 more from me to test grace time extension.

zorro's still needs ENOSPC vs. EDQUOT filtering, darrick's might
need to be made generic, and mine are new.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck
  2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
@ 2020-05-18 19:59   ` Eric Sandeen
  2020-05-31 16:17     ` Eryu Guan
  2020-05-18 20:00   ` [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout Eric Sandeen
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2020-05-18 19:59 UTC (permalink / raw)
  To: linux-xfs, fstests

From: "Darrick J. Wong" <darrick.wong@oracle.com>

Make sure that the default quota grace period and maximum warning limits
set by the administrator survive quotacheck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 tests/xfs/900     | 69 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/900.out | 13 +++++++++
 tests/xfs/group   |  1 +
 3 files changed, 83 insertions(+)
 create mode 100755 tests/xfs/900
 create mode 100644 tests/xfs/900.out

diff --git a/tests/xfs/900 b/tests/xfs/900
new file mode 100755
index 00000000..106a7367
--- /dev/null
+++ b/tests/xfs/900
@@ -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. 900
+#
+# 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
diff --git a/tests/xfs/900.out b/tests/xfs/900.out
new file mode 100644
index 00000000..90d0482c
--- /dev/null
+++ b/tests/xfs/900.out
@@ -0,0 +1,13 @@
+QA output created by 900
+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]
diff --git a/tests/xfs/group b/tests/xfs/group
index 12eb55c9..0818c5c6 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -513,3 +513,4 @@
 513 auto mount
 514 auto quick db
 515 auto quick quota
+900 auto quick quota
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
  2020-05-18 19:59   ` [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck Eric Sandeen
@ 2020-05-18 20:00   ` Eric Sandeen
  2020-05-31 16:15     ` Eryu Guan
  2020-05-18 20:00   ` [PATCH 3/4] fstests: individual user grace period extension via setquota Eric Sandeen
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2020-05-18 20:00 UTC (permalink / raw)
  To: linux-xfs, fstests

From: Zorro Lang <zlang@redhat.com>

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>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 common/quota          |   4 +
 tests/generic/902     | 187 ++++++++++++++++++++++++++++++++++++++++++
 tests/generic/902.out |  41 +++++++++
 tests/generic/group   |   1 +
 4 files changed, 233 insertions(+)
 create mode 100755 tests/generic/902
 create mode 100644 tests/generic/902.out

diff --git a/common/quota b/common/quota
index 240e0bbc..1437d5f7 100644
--- a/common/quota
+++ b/common/quota
@@ -217,6 +217,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/902 b/tests/generic/902
new file mode 100755
index 00000000..03b4dcb3
--- /dev/null
+++ b/tests/generic/902
@@ -0,0 +1,187 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 902
+#
+# 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_setquota_project
+_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
+echo; echo "### Test user quota softlimit and grace time"
+test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE
+# Reset the user quota space & inode limits, avoid it affect later test
+setquota -u $qa_user 0 0 0 0 $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
+echo; echo "### Test group quota softlimit and grace time"
+test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE
+# Reset the group quota space & inode limits, avoid it affect later test
+setquota -g $qa_user 0 0 0 0 $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 project quota softlimit and grace time"
+test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE
+# Reset the project quota space & inode limits
+setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/902.out b/tests/generic/902.out
new file mode 100644
index 00000000..6e15eaeb
--- /dev/null
+++ b/tests/generic/902.out
@@ -0,0 +1,41 @@
+QA output created by 902
+### 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 50c340a6..66e71a70 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -601,3 +601,4 @@
 596 auto quick
 900 auto quick perms
 901 auto quick perms
+902 auto quick quota
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] fstests: individual user grace period extension via setquota
  2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
  2020-05-18 19:59   ` [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck Eric Sandeen
  2020-05-18 20:00   ` [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout Eric Sandeen
@ 2020-05-18 20:00   ` Eric Sandeen
  2020-05-18 20:01   ` [PATCH 4/4] fstests: individual user grace period extension via xfs_quota Eric Sandeen
  2020-05-20 15:39   ` [PATCH 0/4] fstests: more quota related tests Darrick J. Wong
  4 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2020-05-18 20:00 UTC (permalink / raw)
  To: linux-xfs, fstests

Test that we can extend an individual user's grace time once they
reach their soft limit.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 tests/generic/903     | 67 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/903.out |  1 +
 tests/generic/group   |  1 +
 3 files changed, 69 insertions(+)
 create mode 100755 tests/generic/903
 create mode 100644 tests/generic/903.out

diff --git a/tests/generic/903 b/tests/generic/903
new file mode 100755
index 00000000..1903755e
--- /dev/null
+++ b/tests/generic/903
@@ -0,0 +1,67 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 903
+#
+# 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
+
+# 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/903.out b/tests/generic/903.out
new file mode 100644
index 00000000..c0f7f92a
--- /dev/null
+++ b/tests/generic/903.out
@@ -0,0 +1 @@
+QA output created by 903
diff --git a/tests/generic/group b/tests/generic/group
index 66e71a70..ab1b4b8f 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -602,3 +602,4 @@
 900 auto quick perms
 901 auto quick perms
 902 auto quick quota
+903 auto quick quota
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] fstests: individual user grace period extension via xfs_quota
  2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
                     ` (2 preceding siblings ...)
  2020-05-18 20:00   ` [PATCH 3/4] fstests: individual user grace period extension via setquota Eric Sandeen
@ 2020-05-18 20:01   ` Eric Sandeen
  2020-05-20 15:39   ` [PATCH 0/4] fstests: more quota related tests Darrick J. Wong
  4 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2020-05-18 20:01 UTC (permalink / raw)
  To: linux-xfs, fstests

Test that we can extend an individual user's grace time once they
reach their soft limit.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 tests/generic/904     | 78 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/904.out |  1 +
 tests/generic/group   |  1 +
 3 files changed, 80 insertions(+)
 create mode 100755 tests/generic/904
 create mode 100644 tests/generic/904.out

diff --git a/tests/generic/904 b/tests/generic/904
new file mode 100755
index 00000000..8a3b52f2
--- /dev/null
+++ b/tests/generic/904
@@ -0,0 +1,78 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 902
+#
+# Test individual user ID quota grace period extension
+# This is the xfs_quota 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
+# for xfs_quota on generic fs
+_require_xfs_quota_foreign
+# for repquota (if setquota supports it, repquota does too)
+_require_setquota_project
+
+_scratch_mkfs >$seqres.full 2>&1
+_qmount_option "usrquota"
+_qmount
+
+# Test individual timer update functionality; if "-d" is accepted
+# this is xfs_quota that can do default /or/ individual timers
+$XFS_QUOTA_PROG -x -c "timer 0 -d" $SCRATCH_MNT 2>&1 \
+	| grep -q ^timer \
+	&& _notrun "xfs_quota does not support individual grace extension"
+
+# Set a default user inode grace period of 1 second
+$XFS_QUOTA_PROG -x -c "timer -u -i -d 1" $SCRATCH_MNT
+# Soft inode limit 1, hard limit 5
+$XFS_QUOTA_PROG -x -c "limit -u isoft=1 ihard=5 $qa_user" $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
+$XFS_QUOTA_PROG -x -c "timer -u -i 100 $qa_user" $SCRATCH_MNT
+# XXX We use repquota because xfs_quota doesn't know how to return
+# raw ("since epoch") grace expiry
+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/904.out b/tests/generic/904.out
new file mode 100644
index 00000000..c07a2a3c
--- /dev/null
+++ b/tests/generic/904.out
@@ -0,0 +1 @@
+QA output created by 904
diff --git a/tests/generic/group b/tests/generic/group
index ab1b4b8f..d19271aa 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -603,3 +603,4 @@
 901 auto quick perms
 902 auto quick quota
 903 auto quick quota
+904 auto quick quota
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/4] fstests: more quota related tests
  2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
                     ` (3 preceding siblings ...)
  2020-05-18 20:01   ` [PATCH 4/4] fstests: individual user grace period extension via xfs_quota Eric Sandeen
@ 2020-05-20 15:39   ` Darrick J. Wong
  2020-05-20 15:46     ` Eric Sandeen
  4 siblings, 1 reply; 14+ messages in thread
From: Darrick J. Wong @ 2020-05-20 15:39 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs, fstests

On Mon, May 18, 2020 at 02:59:01PM -0500, Eric Sandeen wrote:
> This collects zorro's outstanding patch to test per-type quota
> timers, as well as one test from darrick to test limit survival
> after quotacheck,  plus 2 more from me to test grace time extension.
> 
> zorro's still needs ENOSPC vs. EDQUOT filtering, darrick's might
> need to be made generic, and mine are new.

Err, I saw the following quota fstests regressions overnight.  Are these
expected?  Note that I didn't patch any of the userspace, nor have I
added any of the tests in this series...

--D

--- RESULTS FOR HOST: doh-mtr00.local
FSTESTS LOG DIR "/var/tmp/fstests":
SECTION      -- -no-sections-
FSTYP        -- xfs
MKFS_OPTIONS --  -m reflink=1,rmapbt=1, -i sparse=1,
MOUNT_OPTIONS --  -o usrquota,grpquota,prjquota,
HOST_OPTIONS -- local.config
CHECK_OPTIONS -- -g auto
XFS_MKFS_OPTIONS -- -bsize=4096
TIME_FACTOR  -- 1
LOAD_FACTOR  -- 1
TEST_DIR     -- /mnt
TEST_DEV     -- /dev/sda
SCRATCH_DEV  -- /dev/sdf
SCRATCH_MNT  -- /opt
OVL_UPPER    -- ovl-upper
OVL_LOWER    -- ovl-lower
OVL_WORK     -- ovl-work
KERNEL       -- 5.7.0-rc4-djw
--- xfs/106.out
+++ xfs/106.out.bad
@@ -151,7 +151,7 @@
 checking restore command (type=u)
 
 checking report command (type=u)
-fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days]
+fsgqa 1024 512 2048 00 [0 days] 15 10 20 00 [0 days]
 
 
 checking state command (type=u)
@@ -159,9 +159,9 @@
  Accounting: ON
  Enforcement: ON
  Inode: #[INO] (X blocks, Y extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 cleanup files
 ----------------------- gquota,sync ---------------------------
 init quota limit and timer, and dump it
@@ -315,7 +315,7 @@
 checking restore command (type=g)
 
 checking report command (type=g)
-fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days]
+fsgqa 1024 512 2048 00 [0 days] 15 10 20 00 [0 days]
 
 
 checking state command (type=g)
@@ -323,9 +323,9 @@
  Accounting: ON
  Enforcement: ON
  Inode: #[INO] (X blocks, Y extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 cleanup files
 ----------------------- pquota,sync ---------------------------
 init quota limit and timer, and dump it
@@ -479,7 +479,7 @@
 checking restore command (type=p)
 
 checking report command (type=p)
-fsgqa 1024 512 2048 00 [7 days] 15 10 20 00 [7 days]
+fsgqa 1024 512 2048 00 [0 days] 15 10 20 00 [0 days]
 
 
 checking state command (type=p)
@@ -487,7 +487,7 @@
  Accounting: ON
  Enforcement: ON
  Inode: #[INO] (X blocks, Y extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 cleanup files
--- xfs/299.out
+++ xfs/299.out.bad
@@ -16,19 +16,19 @@
 
 *** push past the soft inode limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 100 500 00 [--------] 5 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 0 100 500 00 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the soft block limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 200 100 500 00 [7 days] 6 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 200 100 500 00 [7 days] 6 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 200 100 500 00 [7 days] 9 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 200 100 500 00 [7 days] 9 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] =OK= 100 500 0 [7 days] 9 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] =OK= 100 500 0 [7 days] 9 4 10 00 [0 days] 0 0 0 00 [--------]
 
 
 *** report no quota settings
--- xfs/050.out
+++ xfs/050.out.bad
@@ -16,19 +16,20 @@
 
 *** push past the soft inode limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 200 1000 00 [--------] 5 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 0 200 1000 00 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the soft block limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 300 200 1000 00 [7 days] 6 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 0 200 1000 00 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 300 200 1000 00 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 0 200 1000 00 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] =OK= 200 1000 0 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] =OK= 200 1000 0 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
+ URK 65534: 0 is out of range! [3481600,4096000]
 
 *** unmount
 *** group
@@ -48,19 +49,19 @@
 
 *** push past the soft inode limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 200 1000 00 [--------] 5 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 0 200 1000 00 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the soft block limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 300 200 1000 00 [7 days] 6 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 300 200 1000 00 [7 days] 6 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 300 200 1000 00 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 300 200 1000 00 [7 days] 10 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] =OK= 200 1000 0 [7 days] 10 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] =OK= 200 1000 0 [7 days] 10 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** unmount
 *** uqnoenforce
@@ -144,19 +145,19 @@
 
 *** push past the soft inode limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 0 200 1000 00 [--------] 5 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 0 200 1000 00 [--------] 5 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the soft block limit
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 300 200 1000 00 [7 days] 6 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 300 200 1000 00 [7 days] 6 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard inode limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] 300 200 1000 00 [7 days] 9 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] 300 200 1000 00 [7 days] 9 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** push past the hard block limit (expect EDQUOT)
 [ROOT] 0 0 0 00 [--------] 3 0 0 00 [--------] 0 0 0 00 [--------]
-[NAME] =OK= 200 1000 0 [7 days] 9 4 10 00 [7 days] 0 0 0 00 [--------]
+[NAME] =OK= 200 1000 0 [7 days] 9 4 10 00 [0 days] 0 0 0 00 [--------]
 
 *** unmount
 *** pqnoenforce
--- generic/594.out
+++ generic/594.out.bad
@@ -5,31 +5,31 @@
 *** Report for group quotas on device SCRATCH_DEV
 Block grace time: DEF_TIME; Inode grace time: DEF_TIME
 *** Report for project quotas on device SCRATCH_DEV
-Block grace time: 00:10; Inode grace time: 00:20
+Block grace time: DEF_TIME; Inode grace time: DEF_TIME
 
 2. set group quota timer
 *** Report for user quotas on device SCRATCH_DEV
 Block grace time: DEF_TIME; Inode grace time: DEF_TIME
 *** Report for group quotas on device SCRATCH_DEV
-Block grace time: 00:30; Inode grace time: 00:40
+Block grace time: DEF_TIME; Inode grace time: DEF_TIME
 *** Report for project quotas on device SCRATCH_DEV
-Block grace time: 00:10; Inode grace time: 00:20
+Block grace time: DEF_TIME; Inode grace time: DEF_TIME
 
 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 test-1
 *** 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
 
 5. fsck to force quota check
 
@@ -37,14 +37,14 @@
 *** 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
 
 7. cycle mount test-3
 *** 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
--- generic/235.out
+++ generic/235.out.bad
@@ -1,25 +1,25 @@
 QA output created by 235
 *** Report for user quotas on device SCRATCH_DEV
-Block grace time: 7days; Inode grace time: 7days
+Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
 fsgqa     --       0       0       0              1     0     0       
 *** Report for group quotas on device SCRATCH_DEV
-Block grace time: 7days; Inode grace time: 7days
+Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
 fsgqa     --       0       0       0              1     0     0       
 touch: cannot touch 'SCRATCH_MNT/failed': Read-only file system
 *** Report for user quotas on device SCRATCH_DEV
-Block grace time: 7days; Inode grace time: 7days
+Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
 fsgqa     --       0       0       0              2     0     0       
 *** Report for group quotas on device SCRATCH_DEV
-Block grace time: 7days; Inode grace time: 7days
+Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
--- xfs/263.out
+++ xfs/263.out.bad
@@ -14,9 +14,9 @@
   Accounting: OFF
   Enforcement: OFF
   Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: grpquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: OFF
@@ -30,9 +30,9 @@
   Accounting: OFF
   Enforcement: OFF
   Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: usrquota,grpquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: ON
@@ -62,9 +62,9 @@
   Accounting: ON
   Enforcement: ON
   Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: usrquota,prjquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: ON
@@ -98,9 +98,9 @@
   Accounting: OFF
   Enforcement: OFF
   Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: grpquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: OFF
@@ -114,9 +114,9 @@
   Accounting: OFF
   Enforcement: OFF
   Inode: N/A
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: usrquota,grpquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: ON
@@ -146,9 +146,9 @@
   Accounting: ON
   Enforcement: ON
   Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: usrquota,prjquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: ON
@@ -178,9 +178,9 @@
   Accounting: ON
   Enforcement: ON
   Inode #XXX (1 blocks, 1 extents)
-Blocks grace time: [7 days]
-Inodes grace time: [7 days]
-Realtime Blocks grace time: [7 days]
+Blocks grace time: [--------]
+Inodes grace time: [--------]
+Realtime Blocks grace time: [--------]
 == Options: usrquota,grpquota,prjquota,rw ==
 User quota state on SCRATCH_MNT (SCRATCH_DEV)
   Accounting: ON

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/4] fstests: more quota related tests
  2020-05-20 15:39   ` [PATCH 0/4] fstests: more quota related tests Darrick J. Wong
@ 2020-05-20 15:46     ` Eric Sandeen
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2020-05-20 15:46 UTC (permalink / raw)
  To: Darrick J. Wong, Eric Sandeen; +Cc: linux-xfs, fstests

On 5/20/20 10:39 AM, Darrick J. Wong wrote:
> On Mon, May 18, 2020 at 02:59:01PM -0500, Eric Sandeen wrote:
>> This collects zorro's outstanding patch to test per-type quota
>> timers, as well as one test from darrick to test limit survival
>> after quotacheck,  plus 2 more from me to test grace time extension.
>>
>> zorro's still needs ENOSPC vs. EDQUOT filtering, darrick's might
>> need to be made generic, and mine are new.
> 
> Err, I saw the following quota fstests regressions overnight.  Are these
> expected?  Note that I didn't patch any of the userspace, nor have I
> added any of the tests in this series...

hrmph, let me dig into this.  I'm not actually sure.
sorry,
-Eric

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-05-18 20:00   ` [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout Eric Sandeen
@ 2020-05-31 16:15     ` Eryu Guan
  2020-06-01 12:48       ` Zorro Lang
  0 siblings, 1 reply; 14+ messages in thread
From: Eryu Guan @ 2020-05-31 16:15 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs, fstests, zlang

On Mon, May 18, 2020 at 03:00:11PM -0500, Eric Sandeen wrote:
> From: Zorro Lang <zlang@redhat.com>
> 
> 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>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---

I saw the following failure as well on xfs (as Zorro mentioned in his v3
patch)

     -pwrite: Disk quota exceeded                                                                                                                                                                                   
     +pwrite: No space left on device

So this is an xfs issue that needs to be fixed? Just want to make sure
the current expected test result.

>  common/quota          |   4 +
>  tests/generic/600     | 187 ++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/600.out |  41 +++++++++
>  tests/generic/group   |   1 +
>  4 files changed, 233 insertions(+)
>  create mode 100755 tests/generic/600
>  create mode 100644 tests/generic/600.out
> 
> diff --git a/common/quota b/common/quota
> index 240e0bbc..1437d5f7 100644
> --- a/common/quota
> +++ b/common/quota
> @@ -217,6 +217,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/600 b/tests/generic/600
> new file mode 100755
> index 00000000..03b4dcb3
> --- /dev/null
> +++ b/tests/generic/600
> @@ -0,0 +1,187 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
> +#
> +# FS QA Test No. 600
> +#
> +# 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_setquota_project
> +_require_quota
> +_require_user
> +_require_group

Hmm, also needs _require_scratch_xfs_crc when FSTYP is xfs, otherwise v4
xfs fails as

+mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/testvg-lv2, missing codepage or helper program, or other error.
+qmount failed

and dmesg says

XFS (dm-2): Super block does not support project and group quota together

Thanks,
Eryu

> +
> +_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
> +echo; echo "### Test user quota softlimit and grace time"
> +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE
> +# Reset the user quota space & inode limits, avoid it affect later test
> +setquota -u $qa_user 0 0 0 0 $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
> +echo; echo "### Test group quota softlimit and grace time"
> +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE
> +# Reset the group quota space & inode limits, avoid it affect later test
> +setquota -g $qa_user 0 0 0 0 $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 project quota softlimit and grace time"
> +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE
> +# Reset the project quota space & inode limits
> +setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/600.out b/tests/generic/600.out
> new file mode 100644
> index 00000000..6e15eaeb
> --- /dev/null
> +++ b/tests/generic/600.out
> @@ -0,0 +1,41 @@
> +QA output created by 600
> +### 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck
  2020-05-18 19:59   ` [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck Eric Sandeen
@ 2020-05-31 16:17     ` Eryu Guan
  0 siblings, 0 replies; 14+ messages in thread
From: Eryu Guan @ 2020-05-31 16:17 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs, fstests

On Mon, May 18, 2020 at 02:59:39PM -0500, Eric Sandeen wrote:
> From: "Darrick J. Wong" <darrick.wong@oracle.com>
> 
> Make sure that the default quota grace period and maximum warning limits
> set by the administrator survive quotacheck.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Ah, this was already merged in last update. Thanks anyway :)

Eryu

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-05-31 16:15     ` Eryu Guan
@ 2020-06-01 12:48       ` Zorro Lang
  2020-06-01 14:36         ` Eric Sandeen
  2020-06-01 16:39         ` Darrick J. Wong
  0 siblings, 2 replies; 14+ messages in thread
From: Zorro Lang @ 2020-06-01 12:48 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Eric Sandeen, linux-xfs, fstests

On Mon, Jun 01, 2020 at 12:15:17AM +0800, Eryu Guan wrote:
> On Mon, May 18, 2020 at 03:00:11PM -0500, Eric Sandeen wrote:
> > From: Zorro Lang <zlang@redhat.com>
> > 
> > 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>
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > ---
> 
> I saw the following failure as well on xfs (as Zorro mentioned in his v3
> patch)
> 
>      -pwrite: Disk quota exceeded
>      +pwrite: No space left on device
> 
> So this is an xfs issue that needs to be fixed? Just want to make sure
> the current expected test result.

Hmm.... I think I'd better to filter ENOSPC|EDQUOT. I can't be sure all
filesystems will return EDQUOT or ENOSPC 100%, especially for group and project
quota.

But I think Eric's trying to change a return value of XFS quota. I don't know the
current status.

Thanks,
Zorro

> 
> >  common/quota          |   4 +
> >  tests/generic/600     | 187 ++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/600.out |  41 +++++++++
> >  tests/generic/group   |   1 +
> >  4 files changed, 233 insertions(+)
> >  create mode 100755 tests/generic/600
> >  create mode 100644 tests/generic/600.out
> > 
> > diff --git a/common/quota b/common/quota
> > index 240e0bbc..1437d5f7 100644
> > --- a/common/quota
> > +++ b/common/quota
> > @@ -217,6 +217,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/600 b/tests/generic/600
> > new file mode 100755
> > index 00000000..03b4dcb3
> > --- /dev/null
> > +++ b/tests/generic/600
> > @@ -0,0 +1,187 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
> > +#
> > +# FS QA Test No. 600
> > +#
> > +# 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_setquota_project
> > +_require_quota
> > +_require_user
> > +_require_group
> 
> Hmm, also needs _require_scratch_xfs_crc when FSTYP is xfs, otherwise v4
> xfs fails as
> 
> +mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/testvg-lv2, missing codepage or helper program, or other error.
> +qmount failed
> 
> and dmesg says
> 
> XFS (dm-2): Super block does not support project and group quota together
> 
> Thanks,
> Eryu
> 
> > +
> > +_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
> > +echo; echo "### Test user quota softlimit and grace time"
> > +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE
> > +# Reset the user quota space & inode limits, avoid it affect later test
> > +setquota -u $qa_user 0 0 0 0 $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
> > +echo; echo "### Test group quota softlimit and grace time"
> > +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE
> > +# Reset the group quota space & inode limits, avoid it affect later test
> > +setquota -g $qa_user 0 0 0 0 $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 project quota softlimit and grace time"
> > +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE
> > +# Reset the project quota space & inode limits
> > +setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/generic/600.out b/tests/generic/600.out
> > new file mode 100644
> > index 00000000..6e15eaeb
> > --- /dev/null
> > +++ b/tests/generic/600.out
> > @@ -0,0 +1,41 @@
> > +QA output created by 600
> > +### 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
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-06-01 12:48       ` Zorro Lang
@ 2020-06-01 14:36         ` Eric Sandeen
  2020-06-01 16:39         ` Darrick J. Wong
  1 sibling, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2020-06-01 14:36 UTC (permalink / raw)
  To: Eryu Guan, linux-xfs, fstests

On 6/1/20 7:48 AM, Zorro Lang wrote:
> On Mon, Jun 01, 2020 at 12:15:17AM +0800, Eryu Guan wrote:
>> On Mon, May 18, 2020 at 03:00:11PM -0500, Eric Sandeen wrote:
>>> From: Zorro Lang <zlang@redhat.com>
>>>
>>> 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>
>>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>>> ---
>>
>> I saw the following failure as well on xfs (as Zorro mentioned in his v3
>> patch)
>>
>>      -pwrite: Disk quota exceeded
>>      +pwrite: No space left on device
>>
>> So this is an xfs issue that needs to be fixed? Just want to make sure
>> the current expected test result.
> 
> Hmm.... I think I'd better to filter ENOSPC|EDQUOT. I can't be sure all
> filesystems will return EDQUOT or ENOSPC 100%, especially for group and project
> quota.
> 
> But I think Eric's trying to change a return value of XFS quota. I don't know the
> current status.

This test will need to be updated, it sounds like ext4 does not plan to switch
to ENOSPC for project quota, so we'll need modify it to accept either one.

Zorro, didn't you do that for another test?  Maybe you can do the same here?

Thanks,
-Eric


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-06-01 12:48       ` Zorro Lang
  2020-06-01 14:36         ` Eric Sandeen
@ 2020-06-01 16:39         ` Darrick J. Wong
  2020-06-11  5:12           ` Zorro Lang
  1 sibling, 1 reply; 14+ messages in thread
From: Darrick J. Wong @ 2020-06-01 16:39 UTC (permalink / raw)
  To: Eryu Guan, Eric Sandeen, linux-xfs, fstests

On Mon, Jun 01, 2020 at 08:48:44PM +0800, Zorro Lang wrote:
> On Mon, Jun 01, 2020 at 12:15:17AM +0800, Eryu Guan wrote:
> > On Mon, May 18, 2020 at 03:00:11PM -0500, Eric Sandeen wrote:
> > > From: Zorro Lang <zlang@redhat.com>
> > > 
> > > 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>
> > > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > > ---
> > 
> > I saw the following failure as well on xfs (as Zorro mentioned in his v3
> > patch)
> > 
> >      -pwrite: Disk quota exceeded
> >      +pwrite: No space left on device
> > 
> > So this is an xfs issue that needs to be fixed? Just want to make sure
> > the current expected test result.
> 
> Hmm.... I think I'd better to filter ENOSPC|EDQUOT. I can't be sure all
> filesystems will return EDQUOT or ENOSPC 100%, especially for group and project
> quota.
> 
> But I think Eric's trying to change a return value of XFS quota. I don't know the
> current status.

Yeah, Eric fixed a few problems where a group quota overage would return
ENOSPC instead of EDQUOT; and a few more problems where a project quota
overage would return EDQUOT instead of ENOSPC.

That'll be coming in the 5.8 merge, which I should get on...

--D

> Thanks,
> Zorro
> 
> > 
> > >  common/quota          |   4 +
> > >  tests/generic/600     | 187 ++++++++++++++++++++++++++++++++++++++++++
> > >  tests/generic/600.out |  41 +++++++++
> > >  tests/generic/group   |   1 +
> > >  4 files changed, 233 insertions(+)
> > >  create mode 100755 tests/generic/600
> > >  create mode 100644 tests/generic/600.out
> > > 
> > > diff --git a/common/quota b/common/quota
> > > index 240e0bbc..1437d5f7 100644
> > > --- a/common/quota
> > > +++ b/common/quota
> > > @@ -217,6 +217,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/600 b/tests/generic/600
> > > new file mode 100755
> > > index 00000000..03b4dcb3
> > > --- /dev/null
> > > +++ b/tests/generic/600
> > > @@ -0,0 +1,187 @@
> > > +#! /bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
> > > +#
> > > +# FS QA Test No. 600
> > > +#
> > > +# 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_setquota_project
> > > +_require_quota
> > > +_require_user
> > > +_require_group
> > 
> > Hmm, also needs _require_scratch_xfs_crc when FSTYP is xfs, otherwise v4
> > xfs fails as
> > 
> > +mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/testvg-lv2, missing codepage or helper program, or other error.
> > +qmount failed
> > 
> > and dmesg says
> > 
> > XFS (dm-2): Super block does not support project and group quota together
> > 
> > Thanks,
> > Eryu
> > 
> > > +
> > > +_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
> > > +echo; echo "### Test user quota softlimit and grace time"
> > > +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE
> > > +# Reset the user quota space & inode limits, avoid it affect later test
> > > +setquota -u $qa_user 0 0 0 0 $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
> > > +echo; echo "### Test group quota softlimit and grace time"
> > > +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE
> > > +# Reset the group quota space & inode limits, avoid it affect later test
> > > +setquota -g $qa_user 0 0 0 0 $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 project quota softlimit and grace time"
> > > +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE
> > > +# Reset the project quota space & inode limits
> > > +setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT
> > > +
> > > +# success, all done
> > > +status=0
> > > +exit
> > > diff --git a/tests/generic/600.out b/tests/generic/600.out
> > > new file mode 100644
> > > index 00000000..6e15eaeb
> > > --- /dev/null
> > > +++ b/tests/generic/600.out
> > > @@ -0,0 +1,41 @@
> > > +QA output created by 600
> > > +### 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
> > 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-06-01 16:39         ` Darrick J. Wong
@ 2020-06-11  5:12           ` Zorro Lang
  2020-06-11 15:40             ` Darrick J. Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Zorro Lang @ 2020-06-11  5:12 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eryu Guan, Eric Sandeen, linux-xfs, fstests

On Mon, Jun 01, 2020 at 09:39:57AM -0700, Darrick J. Wong wrote:
> On Mon, Jun 01, 2020 at 08:48:44PM +0800, Zorro Lang wrote:
> > On Mon, Jun 01, 2020 at 12:15:17AM +0800, Eryu Guan wrote:
> > > On Mon, May 18, 2020 at 03:00:11PM -0500, Eric Sandeen wrote:
> > > > From: Zorro Lang <zlang@redhat.com>
> > > > 
> > > > 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>
> > > > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > > > ---
> > > 
> > > I saw the following failure as well on xfs (as Zorro mentioned in his v3
> > > patch)
> > > 
> > >      -pwrite: Disk quota exceeded
> > >      +pwrite: No space left on device
> > > 
> > > So this is an xfs issue that needs to be fixed? Just want to make sure
> > > the current expected test result.
> > 
> > Hmm.... I think I'd better to filter ENOSPC|EDQUOT. I can't be sure all
> > filesystems will return EDQUOT or ENOSPC 100%, especially for group and project
> > quota.
> > 
> > But I think Eric's trying to change a return value of XFS quota. I don't know the
> > current status.
> 
> Yeah, Eric fixed a few problems where a group quota overage would return
> ENOSPC instead of EDQUOT; and a few more problems where a project quota
> overage would return EDQUOT instead of ENOSPC.
> 
> That'll be coming in the 5.8 merge, which I should get on...

To make sure I don't misunderstand, so the expected output is as below?
1) User quota test:
pwrite: Disk quota exceeded

2) Group quota test:
pwrite: Disk quota exceeded

3) Project quota test:
pwrite: No space left on device / Disk quota exceeded (need a filter)

Thanks,
Zorro

> 
> --D
> 
> > Thanks,
> > Zorro
> > 
> > > 
> > > >  common/quota          |   4 +
> > > >  tests/generic/600     | 187 ++++++++++++++++++++++++++++++++++++++++++
> > > >  tests/generic/600.out |  41 +++++++++
> > > >  tests/generic/group   |   1 +
> > > >  4 files changed, 233 insertions(+)
> > > >  create mode 100755 tests/generic/600
> > > >  create mode 100644 tests/generic/600.out
> > > > 
> > > > diff --git a/common/quota b/common/quota
> > > > index 240e0bbc..1437d5f7 100644
> > > > --- a/common/quota
> > > > +++ b/common/quota
> > > > @@ -217,6 +217,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/600 b/tests/generic/600
> > > > new file mode 100755
> > > > index 00000000..03b4dcb3
> > > > --- /dev/null
> > > > +++ b/tests/generic/600
> > > > @@ -0,0 +1,187 @@
> > > > +#! /bin/bash
> > > > +# SPDX-License-Identifier: GPL-2.0
> > > > +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
> > > > +#
> > > > +# FS QA Test No. 600
> > > > +#
> > > > +# 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_setquota_project
> > > > +_require_quota
> > > > +_require_user
> > > > +_require_group
> > > 
> > > Hmm, also needs _require_scratch_xfs_crc when FSTYP is xfs, otherwise v4
> > > xfs fails as
> > > 
> > > +mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/testvg-lv2, missing codepage or helper program, or other error.
> > > +qmount failed
> > > 
> > > and dmesg says
> > > 
> > > XFS (dm-2): Super block does not support project and group quota together
> > > 
> > > Thanks,
> > > Eryu
> > > 
> > > > +
> > > > +_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
> > > > +echo; echo "### Test user quota softlimit and grace time"
> > > > +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE
> > > > +# Reset the user quota space & inode limits, avoid it affect later test
> > > > +setquota -u $qa_user 0 0 0 0 $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
> > > > +echo; echo "### Test group quota softlimit and grace time"
> > > > +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE
> > > > +# Reset the group quota space & inode limits, avoid it affect later test
> > > > +setquota -g $qa_user 0 0 0 0 $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 project quota softlimit and grace time"
> > > > +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE
> > > > +# Reset the project quota space & inode limits
> > > > +setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT
> > > > +
> > > > +# success, all done
> > > > +status=0
> > > > +exit
> > > > diff --git a/tests/generic/600.out b/tests/generic/600.out
> > > > new file mode 100644
> > > > index 00000000..6e15eaeb
> > > > --- /dev/null
> > > > +++ b/tests/generic/600.out
> > > > @@ -0,0 +1,41 @@
> > > > +QA output created by 600
> > > > +### 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
> > > 
> > 
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout
  2020-06-11  5:12           ` Zorro Lang
@ 2020-06-11 15:40             ` Darrick J. Wong
  0 siblings, 0 replies; 14+ messages in thread
From: Darrick J. Wong @ 2020-06-11 15:40 UTC (permalink / raw)
  To: Eryu Guan, Eric Sandeen, linux-xfs, fstests

On Thu, Jun 11, 2020 at 01:12:43PM +0800, Zorro Lang wrote:
> On Mon, Jun 01, 2020 at 09:39:57AM -0700, Darrick J. Wong wrote:
> > On Mon, Jun 01, 2020 at 08:48:44PM +0800, Zorro Lang wrote:
> > > On Mon, Jun 01, 2020 at 12:15:17AM +0800, Eryu Guan wrote:
> > > > On Mon, May 18, 2020 at 03:00:11PM -0500, Eric Sandeen wrote:
> > > > > From: Zorro Lang <zlang@redhat.com>
> > > > > 
> > > > > 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>
> > > > > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> > > > > ---
> > > > 
> > > > I saw the following failure as well on xfs (as Zorro mentioned in his v3
> > > > patch)
> > > > 
> > > >      -pwrite: Disk quota exceeded
> > > >      +pwrite: No space left on device
> > > > 
> > > > So this is an xfs issue that needs to be fixed? Just want to make sure
> > > > the current expected test result.
> > > 
> > > Hmm.... I think I'd better to filter ENOSPC|EDQUOT. I can't be sure all
> > > filesystems will return EDQUOT or ENOSPC 100%, especially for group and project
> > > quota.
> > > 
> > > But I think Eric's trying to change a return value of XFS quota. I don't know the
> > > current status.
> > 
> > Yeah, Eric fixed a few problems where a group quota overage would return
> > ENOSPC instead of EDQUOT; and a few more problems where a project quota
> > overage would return EDQUOT instead of ENOSPC.
> > 
> > That'll be coming in the 5.8 merge, which I should get on...
> 
> To make sure I don't misunderstand, so the expected output is as below?
> 1) User quota test:
> pwrite: Disk quota exceeded
> 
> 2) Group quota test:
> pwrite: Disk quota exceeded
> 
> 3) Project quota test:
> pwrite: No space left on device / Disk quota exceeded (need a filter)

Yes, that's my understanding of the *intended* behavior. :)

--D

> Thanks,
> Zorro
> 
> > 
> > --D
> > 
> > > Thanks,
> > > Zorro
> > > 
> > > > 
> > > > >  common/quota          |   4 +
> > > > >  tests/generic/600     | 187 ++++++++++++++++++++++++++++++++++++++++++
> > > > >  tests/generic/600.out |  41 +++++++++
> > > > >  tests/generic/group   |   1 +
> > > > >  4 files changed, 233 insertions(+)
> > > > >  create mode 100755 tests/generic/600
> > > > >  create mode 100644 tests/generic/600.out
> > > > > 
> > > > > diff --git a/common/quota b/common/quota
> > > > > index 240e0bbc..1437d5f7 100644
> > > > > --- a/common/quota
> > > > > +++ b/common/quota
> > > > > @@ -217,6 +217,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/600 b/tests/generic/600
> > > > > new file mode 100755
> > > > > index 00000000..03b4dcb3
> > > > > --- /dev/null
> > > > > +++ b/tests/generic/600
> > > > > @@ -0,0 +1,187 @@
> > > > > +#! /bin/bash
> > > > > +# SPDX-License-Identifier: GPL-2.0
> > > > > +# Copyright (c) 2020 Red Hat, Inc.  All Rights Reserved.
> > > > > +#
> > > > > +# FS QA Test No. 600
> > > > > +#
> > > > > +# 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_setquota_project
> > > > > +_require_quota
> > > > > +_require_user
> > > > > +_require_group
> > > > 
> > > > Hmm, also needs _require_scratch_xfs_crc when FSTYP is xfs, otherwise v4
> > > > xfs fails as
> > > > 
> > > > +mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/testvg-lv2, missing codepage or helper program, or other error.
> > > > +qmount failed
> > > > 
> > > > and dmesg says
> > > > 
> > > > XFS (dm-2): Super block does not support project and group quota together
> > > > 
> > > > Thanks,
> > > > Eryu
> > > > 
> > > > > +
> > > > > +_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
> > > > > +echo; echo "### Test user quota softlimit and grace time"
> > > > > +test_grace u $SCRATCH_MNT $UBGRACE $UIGRACE
> > > > > +# Reset the user quota space & inode limits, avoid it affect later test
> > > > > +setquota -u $qa_user 0 0 0 0 $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
> > > > > +echo; echo "### Test group quota softlimit and grace time"
> > > > > +test_grace g $SCRATCH_MNT $GBGRACE $GIGRACE
> > > > > +# Reset the group quota space & inode limits, avoid it affect later test
> > > > > +setquota -g $qa_user 0 0 0 0 $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 project quota softlimit and grace time"
> > > > > +test_grace P $SCRATCH_MNT/t $PBGRACE $PIGRACE
> > > > > +# Reset the project quota space & inode limits
> > > > > +setquota -P $qa_user 0 0 0 0 $SCRATCH_MNT
> > > > > +
> > > > > +# success, all done
> > > > > +status=0
> > > > > +exit
> > > > > diff --git a/tests/generic/600.out b/tests/generic/600.out
> > > > > new file mode 100644
> > > > > index 00000000..6e15eaeb
> > > > > --- /dev/null
> > > > > +++ b/tests/generic/600.out
> > > > > @@ -0,0 +1,41 @@
> > > > > +QA output created by 600
> > > > > +### 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
> > > > 
> > > 
> > 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-06-11 15:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ea649599-f8a9-deb9-726e-329939befade@redhat.com>
2020-05-18 19:59 ` [PATCH 0/4] fstests: more quota related tests Eric Sandeen
2020-05-18 19:59   ` [PATCH 1/4] xfs: make sure our default quota warning limits and grace periods survive quotacheck Eric Sandeen
2020-05-31 16:17     ` Eryu Guan
2020-05-18 20:00   ` [PATCH 2/4] generic: test per-type quota softlimit enforcement timeout Eric Sandeen
2020-05-31 16:15     ` Eryu Guan
2020-06-01 12:48       ` Zorro Lang
2020-06-01 14:36         ` Eric Sandeen
2020-06-01 16:39         ` Darrick J. Wong
2020-06-11  5:12           ` Zorro Lang
2020-06-11 15:40             ` Darrick J. Wong
2020-05-18 20:00   ` [PATCH 3/4] fstests: individual user grace period extension via setquota Eric Sandeen
2020-05-18 20:01   ` [PATCH 4/4] fstests: individual user grace period extension via xfs_quota Eric Sandeen
2020-05-20 15:39   ` [PATCH 0/4] fstests: more quota related tests Darrick J. Wong
2020-05-20 15:46     ` Eric Sandeen

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).