Skip to contentSkip to conversation

Quota tests for XFSQA

PATCH In review Jan Kara 3 participants 25 messages May 24, 2010 – Jul 27, 2010

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

v3 cover Quota tests for XFSQA

Hello,

this is a third version of my quota tests for XFSQA. The first two patches
are just fixes of bugs I've found while adding new tests. Other six patches add new tests.

Changes since last time:
- Fixed detection of quota support for XFS and GFS2 as suggested by Christoph
- Added fix for fallocate support detection
- Added test to verify quota behavior after remount (based on recent kernel bug...)

Comments welcome.

Honza

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#1 lore raw

PATCH v3 1/8 Fix test whether kernel supports quotas

For all 2.6 kernels presence of quota support in kernel can be detected by checking /proc/sys/fs/quota. This is actually more reliable than trying to mount a filesystem with quota options (for example because SCRATCH_DEV does not have to contain a filesystem type we are going to test).

---
 common.quota |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
common.quota +5 -4
index 51bdc71..d32e285 100644
@@ -27,10 +27,11 @@
 _require_quota()
 {
     [ -x /usr/bin/quota ] || _notrun "Quota user tools not installed"
-    _scratch_mount "-o usrquota,grpquota"
-    ret=$?
-    umount $SCRATCH_MNT
-    [ $ret -ne 0 ] && _notrun "Installed kernel does not support quota"
+    if [ $FSTYP = "xfs" ]; then
+	[ -f /proc/fs/xfs/xqmstat ] || _notrun "Installed kernel does not support XFS quota"
+    elif [ $FSTYP != "gfs2" ]; then
+	[ -d /proc/sys/fs/quota ] || _notrun "Installed kernel does not support quota"
+    fi
 }
 
 #
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#2 lore raw

PATCH v3 2/8 Fix fallocate() test

In reply to Jan Kara

The test for fallocate was broken because it used $TEST_DIR/$tmp.io. Because $tmp is usually something like /tmp/1234 or /mnt/1234 the file cannot be created and xfs_io fails regardless of existance of fallocate support. Moreover the subsequent message parsing decides that fallocate is actually supported because it does not expect this message.

Fix the test to not use $tmp.

---
 common.rc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
common.rc +3 -2
index e6d818d..6bf1e12 100644
@@ -803,8 +803,9 @@ _require_user()
 #
 _require_xfs_io_falloc()
 {
-	testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $TEST_DIR/$tmp.io 2>&1`
-	rm -f $TEST_DIR/$tmp.io 2>&1 > /dev/null
+	testfile=$TEST_DIR/$$.falloc
+	testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1`
+	rm -f $testfile 2>&1 > /dev/null
 	echo $testio | grep -q "not found" && \
 		_notrun "xfs_io fallocate support is missing"
 	echo $testio | grep -q "Operation not supported" && \
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#3 lore raw

PATCH v3 3/8 Test basic quota enforcement

In reply to Jan Kara

Add a test which checks whether basic quota enforcement works.

---
 230     |  145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 230.out |  131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 group   |    1 +
 3 files changed, 277 insertions(+), 0 deletions(-)
 create mode 100755 230
 create mode 100644 230.out
230 new file +145 -0
new file mode 100755
index 0000000..e75a828
@@ -0,0 +1,145 @@
+#! /bin/bash
+# FS QA Test No. 230
+#
+# Simple quota enforcement test.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2010 Jan Kara.  All Rights Reserved.
+#
+# Based on test 219,
+# Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+filter_scratch()
+{
+	perl -ne "
+s,$SCRATCH_MNT,[SCR_MNT],;
+s,$SCRATCH_DEV,[SCR_DEV],;
+	print;"
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux #IRIX
+_require_scratch
+_require_quota
+_require_user
+_need_to_be_root
+
+test_files()
+{
+	echo; echo "### create files, setting up ownership (type=$type)"
+	touch $SCRATCH_MNT/file{1,2} 2>/dev/null
+	chown $qa_user $SCRATCH_MNT/file{1,2} 2>/dev/null
+	chgrp $qa_user $SCRATCH_MNT/file{1,2} 2>/dev/null
+	chmod 777 $SCRATCH_MNT 2>/dev/null
+}
+
+test_enforcement()
+{
+	echo "### some buffered IO (type=$type)"
+	echo "--- initiating IO..." >>$seq.full
+	# Firstly fit below block soft limit
+	su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 4096' -c fsync \
+		$SCRATCH_MNT/file1" 2>&1 >>$seq.full | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	# Secondly overcome block soft limit
+	su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 4097' -c fsync \
+		$SCRATCH_MNT/file1" 2>&1 >>$seq.full | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	# Now try to overcome block hardlimit
+	su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 4097' -c fsync \
+		$SCRATCH_MNT/file2" 2>&1 >>$seq.full | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	# Now sleep for grace time and check that softlimit got enforced
+	sleep $grace
+	su $qa_user -c "$XFS_IO_PROG -F -c 'truncate 0' -c 'pwrite 0 1' \
+		$SCRATCH_MNT/file2" 2>&1 >>$seq.full | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	# And now the softlimit test for inodes
+	su $qa_user -c "touch $SCRATCH_MNT/file3" 2>&1 >>$seq.full |
+		filter_scratch | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	# Try to exceed inode hardlimit
+	su $qa_user -c "touch $SCRATCH_MNT/file4 $SCRATCH_MNT/file5" 2>&1 \
+		>>$seq.full | filter_scratch | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	# Wait and check grace time enforcement
+	rm -f $SCRATCH_MNT/file4 >>$seq.full 2>&1
+	sleep $grace
+	su $qa_user -c "touch $SCRATCH_MNT/file4" 2>&1 >>$seq.full |
+		filter_scratch | tee -a $seq.full
+	repquota -$type $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+	echo "--- completed IO ($type)" >>$seq.full
+}
+
+cleanup_files()
+{
+	rm -f $SCRATCH_MNT/file{1,2,3,4,5}
+}
+
+# real QA test starts here
+rm -f $seq.full
+
+grace=2
+
+_scratch_mkfs >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon $SCRATCH_MNT 2>/dev/null
+setquota -u $qa_user 4 12 2 4 $SCRATCH_MNT
+setquota -u -t $grace $grace $SCRATCH_MNT
+setquota -g $qa_user 4 12 2 4 $SCRATCH_MNT
+setquota -g -t $grace $grace $SCRATCH_MNT
+umount $SCRATCH_DEV
+
+echo; echo "### test user limit enforcement"
+_scratch_mount "-o usrquota"
+quotaon $SCRATCH_MNT 2>/dev/null
+type=u
+test_files
+test_enforcement
+cleanup_files
+umount $SCRATCH_DEV 2>/dev/null
+
+echo; echo "### test group limit enforcement"
+_scratch_mount "-o grpquota"
+quotaon $SCRATCH_MNT 2>/dev/null
+type=g
+test_files
+test_enforcement
+cleanup_files
+umount $SCRATCH_DEV 2>/dev/null
+
+status=0
+exit
230.out new file +131 -0

131 lines not on this page · raw message

group +1 -0
index 2c1ac50..441e0e9 100644
@@ -343,3 +343,4 @@ deprecated
 227 auto fsr
 228 rw auto prealloc quick
 229 auto rw
+230 auto quota quick
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

Re: [PATCH 3/8] Test basic quota enforcement

Quoted 1 line · Jan Kara

Add a test which checks whether basic quota enforcement works.

This one fails for me when testing and xfs filesystem on latest Linus' tree (with Debian -testing userspace):

230.out.bad renamed from 230.out +22 -14
@@ -4,20 +4,22 @@
 
 ### create files, setting up ownership (type=u)
 ### some buffered IO (type=u)
+pwrite64: Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     --       4       4      12              2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
+pwrite64: Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -26,7 +28,7 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-      12       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -35,24 +37,26 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12   none       2     2     4       
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file3': Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
 touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       4     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
 touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
@@ -61,7 +65,7 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4   none
+fsgqa     --       0       4      12              2     2     4   none
 
 
 
@@ -69,20 +73,22 @@
 
 ### create files, setting up ownership (type=g)
 ### some buffered IO (type=g)
+pwrite64: Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     --       4       4      12              2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
+pwrite64: Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -91,7 +97,7 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-      12       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -100,24 +106,26 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12   none       2     2     4       
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file3': Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
 touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       4     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
 touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
@@ -126,6 +134,6 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4   none
+fsgqa     --       0       4      12              2     2     4   none
 
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#5 lore raw

Re: [PATCH 3/8] Test basic quota enforcement

230.out.bad line 7

Quoted 13 lines · Christoph Hellwig
Quoted 1 line · Jan Kara

Add a test which checks whether basic quota enforcement works.

This one fails for me when testing and xfs filesystem on latest Linus' tree (with Debian -testing userspace):

230.out.bad renamed from 230.out +1 -0
@@ -4,20 +4,22 @@
 
 ### create files, setting up ownership (type=u)
 ### some buffered IO (type=u)
+pwrite64: Disk quota exceeded

Hmm, the test fails differently for XFS in my setting but it fails as
well. One reason is that XFS starts counting grace time when user reaches softlimit while VFS quotas start counting grace time when user exceeds softlimit.
Another reason probably is that limit 12 KB is too tight for XFS to write
a 4 KB file probably due to delayed allocation. So I'll try to loosen the limits a bit to make test 230 work also for xfs. Thanks for report.

Honza

Quoted 141 lines
230.out.bad renamed from 230.out +21 -14
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     --       4       4      12              2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
+pwrite64: Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -26,7 +28,7 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-      12       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -35,24 +37,26 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12   none       2     2     4       
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file3': Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
 touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       4     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
 touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
@@ -61,7 +65,7 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4   none
+fsgqa     --       0       4      12              2     2     4   none
 
 
 
@@ -69,20 +73,22 @@
 
 ### create files, setting up ownership (type=g)
 ### some buffered IO (type=g)
+pwrite64: Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     --       4       4      12              2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
+pwrite64: Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -91,7 +97,7 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-      12       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -100,24 +106,26 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12   none       2     2     4       
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file3': Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
 touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       4     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
 touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
@@ -126,6 +134,6 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4   none
+fsgqa     --       0       4      12              2     2     4   none
 
 
Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#6 lore raw

Re: [PATCH 3/8] Test basic quota enforcement

In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Jan Kara

Add a test which checks whether basic quota enforcement works.

This one fails for me when testing and xfs filesystem on latest Linus' tree (with Debian -testing userspace):

OK, I've committed a fixed version of the test to the repository.

Honza

Quoted 149 lines
230.out.bad renamed from 230.out +22 -14
@@ -4,20 +4,22 @@
 
 ### create files, setting up ownership (type=u)
 ### some buffered IO (type=u)
+pwrite64: Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     --       4       4      12              2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
+pwrite64: Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -26,7 +28,7 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-      12       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -35,24 +37,26 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12   none       2     2     4       
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file3': Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
 touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
 *** Report for user quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       4     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
 touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
@@ -61,7 +65,7 @@
                         Block limits                File limits
 User            used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4   none
+fsgqa     --       0       4      12              2     2     4   none
 
 
 
@@ -69,20 +73,22 @@
 
 ### create files, setting up ownership (type=g)
 ### some buffered IO (type=g)
+pwrite64: Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     --       4       4      12              2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
+pwrite64: Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -91,7 +97,7 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-      12       4      12  00:00       2     2     4       
+fsgqa     --       0       4      12              2     2     4  00:00
 
 
 pwrite64: Disk quota exceeded
@@ -100,24 +106,26 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     +-       8       4      12   none       2     2     4       
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file3': Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
+touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
 touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded
 *** Report for group quotas on device [SCR_DEV]
 Block grace time: 00:00; Inode grace time: 00:00
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       4     2     4  00:00
+fsgqa     --       0       4      12              2     2     4   none
 
 
 touch: cannot touch `[SCR_MNT]/file4': Disk quota exceeded
@@ -126,6 +134,6 @@
                         Block limits                File limits
 Group           used    soft    hard  grace    used  soft  hard  grace
 ----------------------------------------------------------------------
-fsgqa     ++       8       4      12   none       3     2     4   none
+fsgqa     --       0       4      12              2     2     4   none
 
 
Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw

Re: [PATCH 3/8] Test basic quota enforcement

Quoted 7 lines · Jan Kara
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Jan Kara

Add a test which checks whether basic quota enforcement works.

This one fails for me when testing and xfs filesystem on latest Linus' tree (with Debian -testing userspace):

OK, I've committed a fixed version of the test to the repository.

Thanks, I've pulled your updated tree. Btw, your kernel.org xfstests tree is not a bare repo which will increase the load in the kernel.org servers needlessly.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#8 lore raw

Re: [PATCH 3/8] Test basic quota enforcement

Quoted 5 lines · Christoph Hellwig
Quoted 4 lines · Jan Kara
Quoted 3 lines · Christoph Hellwig
Quoted 1 line · Jan Kara

Add a test which checks whether basic quota enforcement works.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

This one fails for me when testing and xfs filesystem on latest Linus' tree (with Debian -testing userspace):

OK, I've committed a fixed version of the test to the repository.

Thanks, I've pulled your updated tree. Btw, your kernel.org xfstests tree is not a bare repo which will increase the load in the kernel.org servers needlessly.

Thanks! I've now removed the repo and next time when I need it I will
create a proper bare repository.

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#9 lore raw

PATCH v3 4/8 Add test of quota accounting using fsx

In reply to Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

---
 231     |  141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 231.out |   10 ++++
 group   |    1 +
 3 files changed, 152 insertions(+), 0 deletions(-)
 create mode 100755 231
 create mode 100644 231.out
231 new file +141 -0
new file mode 100755
index 0000000..ebbe11e
@@ -0,0 +1,141 @@
+#! /bin/bash
+# FSQA Test No. 231
+#
+# Run fsx with quotas enabled and verify accounted quotas in the end
+#
+# Derived from test 127
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+FSX_FILE_SIZE=64000000
+FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -N 20000"
+
+filter_scratch()
+{
+        perl -ne "
+s,$SCRATCH_MNT,[SCR_MNT],;
+s,$SCRATCH_DEV,[SCR_DEV],;
+        print;"
+}
+
+check_usage()
+{
+	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
+	repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
+		>$tmp.orig
+	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+	repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
+		>$tmp.checked
+	quotaon -u -g $SCRATCH_MNT 2>/dev/null
+	diff $tmp.orig $tmp.checked
+}
+
+_fsx()
+{
+	tasks=$1
+	echo "=== FSX Standard Mode, Memory Mapping, $tasks Tasks ==="
+	for (( i = 1; i <= $tasks; i++ )); do
+		SEED=$RANDOM
+		echo "ltp/fsx $FSX_ARGS -S $SEED $SCRATCH_MNT/fsx_file$i" >>$seq.full
+		su $qa_user -c "ltp/fsx $FSX_ARGS -S $SEED \
+			$SCRATCH_MNT/fsx_file$i" >$tmp.output$i 2>&1 &
+	done
+
+	for (( i = 1; i <= $tasks; i++ )); do
+		if ! wait %$i; then
+			cat $tmp.output$i | tee -a $seq.full
+			wait
+			return 1
+		fi
+		$XFS_IO_PROG -F -c 'fsync' $SCRATCH_MNT/fsx_file$i
+		cat $tmp.output$i | tee -a $seq.full
+	done
+	return 0
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_require_user
+_need_to_be_root
+
+_scratch_mkfs >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+chmod 777 $SCRATCH_MNT
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon -u -g $SCRATCH_MNT 2>/dev/null
+
+if ! _fsx 1; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+if ! check_usage; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+if ! _fsx 4; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+if ! check_usage; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+#flush cache after write
+FSX_ARGS="-f $FSX_ARGS"
+if ! _fsx 1; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+if ! check_usage; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+umount $SCRATCH_DEV 2>/dev/null
+status=0
+exit
231.out new file +10 -0
new file mode 100644
index 0000000..2f2d072
@@ -0,0 +1,10 @@
+QA output created by 231
+=== FSX Standard Mode, Memory Mapping, 1 Tasks ===
+All operations completed A-OK!
+=== FSX Standard Mode, Memory Mapping, 4 Tasks ===
+All operations completed A-OK!
+All operations completed A-OK!
+All operations completed A-OK!
+All operations completed A-OK!
+=== FSX Standard Mode, Memory Mapping, 1 Tasks ===
+All operations completed A-OK!
group +1 -0
index 441e0e9..6b59c69 100644
@@ -344,3 +344,4 @@ deprecated
 228 rw auto prealloc quick
 229 auto rw
 230 auto quota quick
+231 auto quota
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#10 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

+Disabling group quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2 +Disabling user quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2 +repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled. +repquota: Not all specified mountpoints are using quota.
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled. +repquota: Not all specified mountpoints are using quota.

...

however if I remove the quotaon calls (off / on settings) in check_usage() then it works:

check_usage()
{

        # quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.orig
        quotacheck -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.checked
        # quotaon -u -g $SCRATCH_MNT 2>/dev/null
        diff $tmp.orig $tmp.checked
}

Seems like 2 issues: noisy disable messages, and repquota failing when disabled.

Any ideas?

Thanks,
-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#11 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 32 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

(quoted diff) +6 -0
+Disabling group quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2
+Disabling user quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled.
+repquota: Not all specified mountpoints are using quota.
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled.
+repquota: Not all specified mountpoints are using quota.
 
...

however if I remove the quotaon calls (off / on settings) in check_usage() then it works:

check_usage()
{

        # quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.orig
        quotacheck -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.checked
        # quotaon -u -g $SCRATCH_MNT 2>/dev/null
        diff $tmp.orig $tmp.checked
}
Quoted 1 line

Seems like 2 issues: noisy disable messages, and repquota failing when disabled.

I've fixed noisy disable messages in quotaon (without -v flag only errors
should be printed) in CVS. With repquota & disabled quotas it's a bit more complicated. The problem is that for ext?, reiserfs,... you have to disable quotas before running quotacheck. Also quotacheck is NOP for XFS - we'd rather need to call something to really recompute quota usage for XFS. How that can be done?

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#12 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 32 lines · Jan Kara
Quoted 31 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

(quoted diff) +6 -0
+Disabling group quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2
+Disabling user quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled.
+repquota: Not all specified mountpoints are using quota.
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled.
+repquota: Not all specified mountpoints are using quota.
 
...

however if I remove the quotaon calls (off / on settings) in check_usage() then it works:

check_usage()
{

        # quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.orig
        quotacheck -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.checked
        # quotaon -u -g $SCRATCH_MNT 2>/dev/null
        diff $tmp.orig $tmp.checked
}
Quoted 3 lines
Quoted 1 line

Seems like 2 issues: noisy disable messages, and repquota failing when disabled.

I've fixed noisy disable messages in quotaon (without -v flag only errors
should be printed) in CVS.

Ok, we should probably just add a filter for these so that it'll work on older versions.

Quoted 2 lines

With repquota & disabled quotas it's a bit more
complicated.

Hm I'm still woefully unfamiliar with quota intricacies.

It seems that after quotaon -f, repquota fails on xfs but works for ext*?

Not sure if that's intended...

Also is there a reason to disable quota before repquota? Is disable/enable around quotacheck enough?

Hm on ext* I'm also getting differences from the expected output; I suspect due to selinux xattrs. I'll try to get that fixed up.

Quoted 4 lines

The problem is that for ext?, reiserfs,... you have to disable quotas before running quotacheck. Also quotacheck is NOP for XFS - we'd rather need to call something to really recompute quota usage for XFS. How that can be done?

It's regenerated at mount time if needed. I don't know that we have a method to force this recalculation... I guess mounting with quotas disabled, unmounting, then mounting again w/ quotas on will do it.

Thanks,
-Eric

Quoted 1 line

Honza

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#13 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 7 lines · Eric Sandeen
Quoted 6 lines · Jan Kara
Quoted 5 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

These don't seem to be working properly at all with xfs.

In quota-3.17, quotaoff seems to turn off both accounting and enforcement, despite what the man page says -

To turn off quota limit enforcement on any XFS filesystem, first make sure that quota accounting and enforcement are both turned on using repquota -v
filesystem. Then, use quotaoff -v filesystem to disable limit enforce-
ment. This may be done while the filesystem is mounted.

And once accounting is turned off, it can't be re-enabled without a remount.

With quota-4.0.0-preX, it seems to turn off -neither- accounting nor enforcement, based on hch's test:

[14:59]  <hch> qemu1:~/xfstests-dev# mount -o quota /dev/vdb5 /mnt/test
[14:59]  <hch> qemu1:~/xfstests-dev# quotaon -f /dev/vdb5
[15:00]  <hch> qemu1:~/xfstests-dev# quotaon /dev/vdb5
[15:00]  <hch> quotaon: Enable XFS group quota accounting during mount
[15:00]  <hch> quotaon: Enforcing user quota already on /dev/vdb5
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Argh ;)

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#14 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 24 lines · Eric Sandeen
Quoted 7 lines · Eric Sandeen
Quoted 6 lines · Jan Kara
Quoted 5 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

These don't seem to be working properly at all with xfs.

In quota-3.17, quotaoff seems to turn off both accounting and enforcement, despite what the man page says -

To turn off quota limit enforcement on any XFS filesystem, first make sure that quota accounting and enforcement are both turned on using repquota -v
filesystem. Then, use quotaoff -v filesystem to disable limit enforce-
ment. This may be done while the filesystem is mounted.

And once accounting is turned off, it can't be re-enabled without a remount.

With quota-4.0.0-preX, it seems to turn off -neither- accounting nor enforcement, based on hch's test:

Quoted 8 lines
[14:59]  <hch> qemu1:~/xfstests-dev# mount -o quota /dev/vdb5 /mnt/test
[14:59]  <hch> qemu1:~/xfstests-dev# quotaon -f /dev/vdb5
[15:00]  <hch> qemu1:~/xfstests-dev# quotaon /dev/vdb5
[15:00]  <hch> quotaon: Enable XFS group quota accounting during mount
[15:00]  <hch> quotaon: Enforcing user quota already on /dev/vdb5
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Argh ;)

Ah, not many people seem to use quotaon(8) with XFS :). The fact that we
turned off both enforcement and accounting was originally intended I think (Nathan Scott wrote the code) but I agree with you that it makes more sence to turn off just enforcement as is stated in the manpage. The check in quotaon.c:newstate() was buggy and worked only by luck for XFS. After I fixed error checking of kern_quota_on the check stopped working...
I have now committed changes to quota-tools and checked that quotaon now
works reasonably with XFS so it should be cleaned up hopefully.

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#15 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

In reply to Eric Sandeen
Quoted 33 lines · Eric Sandeen
Quoted 32 lines · Jan Kara
Quoted 31 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

(quoted diff) +6 -0
+Disabling group quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2
+Disabling user quota enforcement and accounting on /dev/mapper/VolGroup00-testvol2
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled.
+repquota: Not all specified mountpoints are using quota.
+repquota: Mountpoint (or device) /mnt/testarea/scratch not found or has no quota enabled.
+repquota: Not all specified mountpoints are using quota.
 
...

however if I remove the quotaon calls (off / on settings) in check_usage() then it works:

check_usage()
{

        # quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.orig
        quotacheck -u -g $SCRATCH_MNT 2>/dev/null
        repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
                >$tmp.checked
        # quotaon -u -g $SCRATCH_MNT 2>/dev/null
        diff $tmp.orig $tmp.checked
}
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Seems like 2 issues: noisy disable messages, and repquota failing when disabled.

I've fixed noisy disable messages in quotaon (without -v flag only errors
should be printed) in CVS.

Ok, we should probably just add a filter for these so that it'll work on older versions.

OK, will add that.

Quoted 6 lines
Quoted 2 lines

With repquota & disabled quotas it's a bit more
complicated.

Hm I'm still woefully unfamiliar with quota intricacies.

It seems that after quotaon -f, repquota fails on xfs but works for ext*?

Yes, because we disabled also accounting. But with your change to quota
tools it shouldn't be a problem anymore. Still I've added a test so that we turn quotas off only for ext? and reiserfs so that the tests work with older quota tools as well.

Quoted 4 lines

Not sure if that's intended...

Also is there a reason to disable quota before repquota? Is disable/enable around quotacheck enough?

Yes, that would be enough.

Quoted 2 lines

Hm on ext* I'm also getting differences from the expected output; I suspect due to selinux xattrs. I'll try to get that fixed up.

I'm seeing some quota miscomputations for ext4, but ext2 and ext3 work
fine for me. I didn't have time to look into why ext4 after quotacheck reports different number of blocks. Maybe it's just delayed allocation, maybe it's a real bug.

Quoted 8 lines
Quoted 4 lines

The problem is that for ext?, reiserfs,... you have to disable quotas before running quotacheck. Also quotacheck is NOP for XFS - we'd rather need to call something to really recompute quota usage for XFS. How that can be done?

It's regenerated at mount time if needed. I don't know that we have a method to force this recalculation... I guess mounting with quotas disabled, unmounting, then mounting again w/ quotas on will do it.

OK, I'll add this to the test.

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#16 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

In reply to Eric Sandeen
Quoted 6 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

OK, attached is an improvement to the XFSQA tests after which all quota
tests pass for XFS just fine.
The second patch is just minor general improvement of _require_scratch
macro.
Could they be added to XFSQA repository? Thanks.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
Quoted 1 line

From 5f184d21e781f1b14365c356e6c80030964aaaf7 Mon Sep 17 00:00:00 2001

From: Jan Kara <[email protected]>
Date: Thu, 10 Jun 2010 12:49:11 +0200
Subject: [PATCH 1/2] Provide generic function for checking quota usage

Provide generic function _check_quota_usage for checking whether quota usage matches the space used and use it in proper tests.

---
 231          |   18 +++---------------
 231.out      |    6 ++++++
 232          |   14 +-------------
 232.out      |    2 ++
 233          |   14 +-------------
 233.out      |    2 ++
 common.quota |   36 ++++++++++++++++++++++++++++++++++++
 7 files changed, 51 insertions(+), 41 deletions(-)
231 +3 -15
index ebbe11e..e499c9a 100755
@@ -49,18 +49,6 @@ s,$SCRATCH_DEV,[SCR_DEV],;
         print;"
 }
 
-check_usage()
-{
-	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
-		>$tmp.orig
-	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch \
-		>$tmp.checked
-	quotaon -u -g $SCRATCH_MNT 2>/dev/null
-	diff $tmp.orig $tmp.checked
-}
-
 _fsx()
 {
 	tasks=$1
@@ -104,7 +92,7 @@ if ! _fsx 1; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
@@ -116,7 +104,7 @@ if ! _fsx 4; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
@@ -130,7 +118,7 @@ if ! _fsx 1; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
231.out +6 -0
index 2f2d072..ef264a9 100644
@@ -1,10 +1,16 @@
 QA output created by 231
 === FSX Standard Mode, Memory Mapping, 1 Tasks ===
 All operations completed A-OK!
+Comparing user usage
+Comparing group usage
 === FSX Standard Mode, Memory Mapping, 4 Tasks ===
 All operations completed A-OK!
 All operations completed A-OK!
 All operations completed A-OK!
 All operations completed A-OK!
+Comparing user usage
+Comparing group usage
 === FSX Standard Mode, Memory Mapping, 1 Tasks ===
 All operations completed A-OK!
+Comparing user usage
+Comparing group usage
232 +1 -13
index cf4d25a..d5f99bd 100755
@@ -46,18 +46,6 @@ s,$SCRATCH_DEV,[SCR_DEV],;
         print;"
 }
 
-check_usage()
-{
-	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.orig
-	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.checked
-	quotaon -u -g $SCRATCH_MNT 2>/dev/null
-	diff $tmp.orig $tmp.checked
-}
-
 _filter_num()
 {
 	tee -a $here/$seq.full |\
@@ -104,7 +92,7 @@ if ! _fsstress; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
232.out +2 -0
index 744192e..ef82a89 100644
@@ -4,3 +4,5 @@ Testing fsstress
 
 fsstress -n 2000 -d outdir -p 7
 seed = S
+Comparing user usage
+Comparing group usage
233 +1 -13
index b967e0d..5060931 100755
@@ -50,18 +50,6 @@ s,$SCRATCH_DEV,[SCR_DEV],;
         print;"
 }
 
-check_usage()
-{
-	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.orig
-	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
-		sort >$tmp.checked
-	quotaon -u -g $SCRATCH_MNT 2>/dev/null
-	diff $tmp.orig $tmp.checked
-}
-
 _filter_num()
 {
 	tee -a $here/$seq.full |\
@@ -113,7 +101,7 @@ if ! _fsstress; then
 	exit
 fi
 
-if ! check_usage; then
+if ! _check_quota_usage; then
 	umount $SCRATCH_DEV 2>/dev/null
 	status=1
 	exit
233.out +2 -0
index 208910d..fa36ca3 100644
@@ -4,3 +4,5 @@ Testing fsstress
 
 fsstress -z -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 -n 5000 -d outdir -p 7
 seed = S
+Comparing user usage
+Comparing group usage
common.quota +36 -0
index d32e285..655e34d 100644
@@ -211,5 +211,41 @@ _qmount_option()
 	echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seq.full
 }
 
+_check_quota_usage()
+{
+	# Sync to get delalloc to disk
+	sync
+	VFS_QUOTA=0
+	if [ $FSTYP = "ext2" -o $FSTYP = "ext3" -o $FSTYP = "ext4" -o $FSTYP = "reiserfs" ]; then
+		VFS_QUOTA=1
+		quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
+	fi
+	repquota -u -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.user.orig
+	repquota -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.group.orig
+	if [ $VFS_QUOTA -eq 1 ]; then
+		quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+	else
+		# use XFS method to force quotacheck
+		mount -o remount,noquota $SCRATCH_DEV
+		mount -o remount,usrquota,grpquota $SCRATCH_DEV
+	fi
+	repquota -u -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.user.checked
+	repquota -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.group.checked
+	if [ $VFS_QUOTA -eq 1 ]; then
+		quotaon -u -g $SCRATCH_MNT 2>/dev/null
+	fi
+	{
+		echo "Comparing user usage"
+		diff $tmp.user.orig $tmp.user.checked
+	} && {
+		echo "Comparing group usage"
+		diff $tmp.group.orig $tmp.group.checked
+	}
+}
+
 # make sure this script returns success
 /bin/true
Signature · 1 line
1.6.4.2
Quoted 1 line

From d72c11b63aa22c920b460a71d4384c2f39be6513 Mon Sep 17 00:00:00 2001

From: Jan Kara <[email protected]>
Date: Tue, 15 Jun 2010 10:54:12 +0200
Subject: [PATCH 2/2] Add test for correct $SCRATCH_MNT into _require_scratch

---
 common.rc |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common.rc +4 -0
index 6bf1e12..72997f9 100644
@@ -703,6 +703,10 @@ _require_scratch()
 		 then
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
+		if [ ! -d "$SCRATCH_MNT" ]
+		then
+		     _notrun "this test requires a valid \$SCRATCH_MNT"
+		fi
 		 ;;
     esac
 
Signature · 1 line
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#17 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 5 lines · Jan Kara
Quoted 4 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Quoted 7 lines
Quoted 2 lines

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

OK, attached is an improvement to the XFSQA tests after which all quota
tests pass for XFS just fine.
The second patch is just minor general improvement of _require_scratch
macro.
Could they be added to XFSQA repository? Thanks.

Jan, I've got some ext4 failures reported on these, although I can't hit them, so not quite sure what's going on.

In 231:

+< fsgqa -- 760 0 0 3 0 0

+---
+> fsgqa     --     764       0       0              3     0     0
+14c14
+< fsgqa     --     760       0       0              3     0     0
+---
+> fsgqa     --     764       0       0              3     0     0

after the quotacheck & repquota we have 4 more blocks. Maybe this is due to my accounting of metadata blocks at write time, and not before ... would it be reasonable to put a sync call as the first line of check_usage() ?

Also in 233:

+< #501      --   15392       0       0            998     0     0
+< #501      --   15392   32000   32000            998  1000  1000
+---
+> #501      +-   32084   32000   32000  7days     998  1000  1000
+> #501      --   32084       0       0            998     0     0

"7days" magically appeared after the quotacheck. Not sure what's going on there...

Thanks,
-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#18 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 27 lines · Eric Sandeen
Quoted 5 lines · Jan Kara
Quoted 4 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Quoted 7 lines
Quoted 2 lines

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

OK, attached is an improvement to the XFSQA tests after which all quota
tests pass for XFS just fine.
The second patch is just minor general improvement of _require_scratch
macro.
Could they be added to XFSQA repository? Thanks.

Jan, I've got some ext4 failures reported on these, although I can't hit them, so not quite sure what's going on.

In 231:

+< fsgqa -- 760 0 0 3 0 0

+---
+> fsgqa     --     764       0       0              3     0     0
+14c14
+< fsgqa     --     760       0       0              3     0     0
+---
+> fsgqa     --     764       0       0              3     0     0
Quoted 4 lines

after the quotacheck & repquota we have 4 more blocks. Maybe this is due to my accounting of metadata blocks at write time, and not before ... would it be reasonable to put a sync call as the first line of check_usage() ?

Just last week a change went into xfstests which introduces a generic
quota checking function and uses sync before getting quota usage. I think xfstests passed for me with ext4 after this change but I've now restarted the tests to recheck it.

Quoted 10 lines

Also in 233:

+< #501      --   15392       0       0            998     0     0
+< #501      --   15392   32000   32000            998  1000  1000
+---
+> #501      +-   32084   32000   32000  7days     998  1000  1000
+> #501      --   32084       0       0            998     0     0

"7days" magically appeared after the quotacheck. Not sure what's going on there...

That's because the usage after checking exceeded block soft limit and
thus grace time has been set. So it's the same problem as in the above test.

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#19 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 28 lines · Jan Kara
Quoted 27 lines · Eric Sandeen
Quoted 5 lines · Jan Kara
Quoted 4 lines · Eric Sandeen
Quoted 2 lines · Jan Kara

Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish.

Quoted 7 lines
Quoted 2 lines

Jan, I'm having trouble with this one on XFS for some reason, with our RHEL6 kernel and quota-3.17...

OK, attached is an improvement to the XFSQA tests after which all quota
tests pass for XFS just fine.
The second patch is just minor general improvement of _require_scratch
macro.
Could they be added to XFSQA repository? Thanks.

Jan, I've got some ext4 failures reported on these, although I can't hit them, so not quite sure what's going on.

In 231:

+< fsgqa -- 760 0 0 3 0 0

+---
+> fsgqa     --     764       0       0              3     0     0
+14c14
+< fsgqa     --     760       0       0              3     0     0
+---
+> fsgqa     --     764       0       0              3     0     0
Quoted 8 lines
Quoted 4 lines

after the quotacheck & repquota we have 4 more blocks. Maybe this is due to my accounting of metadata blocks at write time, and not before ... would it be reasonable to put a sync call as the first line of check_usage() ?

Just last week a change went into xfstests which introduces a generic
quota checking function and uses sync before getting quota usage. I think xfstests passed for me with ext4 after this change but I've now restarted the tests to recheck it.

For me all the quota tests pass just fine with ext4 and the latest
xfstests... So does the latest version work also for you?

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#20 lore raw

Re: [PATCH 4/8] Add test of quota accounting using fsx

Quoted 8 lines · Jan Kara
Quoted 5 lines
Quoted 1 line

Just last week a change went into xfstests which introduces a generic
quota checking function and uses sync before getting quota usage. I think xfstests passed for me with ext4 after this change but I've now restarted the tests to recheck it.

For me all the quota tests pass just fine with ext4 and the latest
xfstests... So does the latest version work also for you?

Whoops sorry, they do pass for me in the devel tree; I had missed that recent change and I guess our qa had tested a tree without it. I wondered why it didn't work for them... Sorry for the noise....

Eric

Quoted 5 lines

Honza
--
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#21 lore raw

PATCH v3 5/8 Add quota test with fsstress

In reply to Jan Kara

Run fsstress and verify that quota accounting is correct after it finishes.

---
 232     |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 232.out |    6 +++
 group   |    1 +
 3 files changed, 122 insertions(+), 0 deletions(-)
 create mode 100755 232
 create mode 100644 232.out
232 new file +115 -0
new file mode 100755
index 0000000..cf4d25a
@@ -0,0 +1,115 @@
+#! /bin/bash
+# FSQA Test No. 232
+#
+# Run fsstress with quotas enabled and verify accounted quotas in the end
+#
+# Derived from test 231
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+filter_scratch()
+{
+        perl -ne "
+s,$SCRATCH_MNT,[SCR_MNT],;
+s,$SCRATCH_DEV,[SCR_DEV],;
+        print;"
+}
+
+check_usage()
+{
+	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
+	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.orig
+	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.checked
+	quotaon -u -g $SCRATCH_MNT 2>/dev/null
+	diff $tmp.orig $tmp.checked
+}
+
+_filter_num()
+{
+	tee -a $here/$seq.full |\
+	sed -e 's/[0-9][0-9]* inodes/I inodes/g' \
+	    -e 's/[0-9][0-9]* paths/P paths/g' \
+	    -e 's/seed = [0-9][0-9]*/seed = S/'
+}
+
+_fsstress()
+{
+	echo ""
+	echo "Testing fsstress"
+	echo ""
+
+	out=$SCRATCH_MNT/fsstress.$$
+	count=2000
+	args="-n $count -d $out -p 7"
+
+	echo "fsstress $args" | tee -a $here/$seq.full | sed -e "s#$out#outdir#"
+	if ! $FSSTRESS_PROG $args | tee -a $here/$seq.full | _filter_num
+	then
+		echo "    fsstress $args returned $?"
+		cat $tmp.out | tee -a $here/$seq.full
+		status=1
+	fi
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+chmod 777 $SCRATCH_MNT
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon -u -g $SCRATCH_MNT 2>/dev/null
+
+if ! _fsstress; then
+	umount $SCRATCH_DEV 2>/dev/null
+	exit
+fi
+
+if ! check_usage; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+umount $SCRATCH_DEV 2>/dev/null
+status=0
+exit
232.out new file +6 -0
new file mode 100644
index 0000000..744192e
@@ -0,0 +1,6 @@
+QA output created by 232
+
+Testing fsstress
+
+fsstress -n 2000 -d outdir -p 7
+seed = S
group +1 -0
index 6b59c69..c8cd774 100644
@@ -345,3 +345,4 @@ deprecated
 229 auto rw
 230 auto quota quick
 231 auto quota
+232 auto quota
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#22 lore raw

PATCH v3 6/8 Add quota accounting test when fsstress is run and quota limits are set low

In reply to Jan Kara

Test various error recovery paths whether they properly handle EDQUOT failures.

---
 233     |  124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 233.out |    6 +++
 group   |    1 +
 3 files changed, 131 insertions(+), 0 deletions(-)
 create mode 100755 233
 create mode 100644 233.out
233 new file +124 -0
new file mode 100755
index 0000000..b967e0d
@@ -0,0 +1,124 @@
+#! /bin/bash
+# FSQA Test No. 233
+#
+# Run fsstress with quotas enabled and limits set low and verify accounted
+# quotas in the end
+#
+# Derived from test 231
+#-----------------------------------------------------------------------
+# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+FSX_FILE_SIZE=64000000
+FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"
+
+filter_scratch()
+{
+        perl -ne "
+s,$SCRATCH_MNT,[SCR_MNT],;
+s,$SCRATCH_DEV,[SCR_DEV],;
+        print;"
+}
+
+check_usage()
+{
+	quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
+	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.orig
+	quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+	repquota -u -g -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch |
+		sort >$tmp.checked
+	quotaon -u -g $SCRATCH_MNT 2>/dev/null
+	diff $tmp.orig $tmp.checked
+}
+
+_filter_num()
+{
+	tee -a $here/$seq.full |\
+	sed -e 's/[0-9][0-9]* inodes/I inodes/g' \
+	    -e 's/[0-9][0-9]* paths/P paths/g' \
+	    -e 's/seed = [0-9][0-9]*/seed = S/'
+}
+
+_fsstress()
+{
+	echo ""
+	echo "Testing fsstress"
+	echo ""
+
+	out=$SCRATCH_MNT/fsstress.$$
+	count=5000
+	args="-z \
+-f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 \
+-f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
+-n $count -d $out -p 7"
+
+	echo "fsstress $args" | tee -a $here/$seq.full | sed -e "s#$out#outdir#"
+	if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $here/$seq.full | _filter_num
+	then
+		echo "    fsstress $args returned $?"
+		cat $tmp.out | tee -a $here/$seq.full
+		status=1
+	fi
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_require_user
+_need_to_be_root
+
+umount $SCRATCH_DEV 2>/dev/null
+_scratch_mkfs >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+chmod 777 $SCRATCH_MNT
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon -u -g $SCRATCH_MNT 2>/dev/null
+setquota -u $qa_user 32000 32000 1000 1000 $SCRATCH_MNT 2>/dev/null
+
+if ! _fsstress; then
+	umount $SCRATCH_DEV 2>/dev/null
+	exit
+fi
+
+if ! check_usage; then
+	umount $SCRATCH_DEV 2>/dev/null
+	status=1
+	exit
+fi
+
+umount $SCRATCH_DEV 2>/dev/null
+status=0
+exit
233.out new file +6 -0
new file mode 100644
index 0000000..208910d
@@ -0,0 +1,6 @@
+QA output created by 233
+
+Testing fsstress
+
+fsstress -z -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 -n 5000 -d outdir -p 7
+seed = S
group +1 -0
index c8cd774..cc9bdb2 100644
@@ -346,3 +346,4 @@ deprecated
 230 auto quota quick
 231 auto quota
 232 auto quota
+233 auto quota
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#23 lore raw

PATCH v3 7/8 Add test of quota limit and info setting

In reply to Jan Kara

Add test stressing addition and removal of quota structures and setting of quota grace time.

---
 234     |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 234.out |    4 ++
 group   |    1 +
 3 files changed, 113 insertions(+), 0 deletions(-)
 create mode 100755 234
 create mode 100644 234.out
234 new file +108 -0
new file mode 100755
index 0000000..4e98035
@@ -0,0 +1,108 @@
+#! /bin/bash
+# FS QA Test No. 234
+#
+# Stress setquota and setinfo handling.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2010 Jan Kara.  All Rights Reserved.
+#
+# Based on test 219,
+# Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+test_setting()
+{
+	echo; echo "### test limits and info setting"
+	count=2000
+	procs=5
+	idmod=200000
+	seed=$RANDOM
+	RANDOM=$seed
+	echo "Starting test with procs=$procs, idmod=$idmod, and seed=$seed" >>$seq.full
+
+	for (( i = 0; i < $procs; i++ )); do
+		( SETUCOUNT=1; SETGCOUNT=1; SETUIDS[0]=0; SETGIDS[0]=0
+		for (( j = 0; j < $count; j++ )); do
+			OP=$(($RANDOM%22))
+			UG=$(($OP%2))
+			OP=$(($OP/2))
+			if [ $UG -eq 1 ]; then
+				type='u'
+			else
+				type='g'
+			fi
+			if [ $OP -eq 10 ]; then
+				setquota -t -$type $j $j $SCRATCH_MNT
+			elif [ $OP -lt 5 ]; then
+				ID=$((($RANDOM*32768+$RANDOM)%$idmod))
+				if [ $UG -eq 1 ]; then
+					SETUIDS[$SETUCOUNT]=$ID
+					SETUCOUNT=$(($SETUCOUNT+1))
+				else
+					SETGIDS[$SETGCOUNT]=$ID
+					SETGCOUNT=$(($SETGCOUNT+1))
+				fi
+				setquota -$type $ID $j $j $j $j $SCRATCH_MNT
+			else
+				if [ $UG -eq 1 ]; then
+					ID=${SETUIDS[$(($RANDOM%$SETUCOUNT))]}
+				else
+					ID=${SETGIDS[$(($RANDOM%$SETGCOUNT))]}
+				fi
+				setquota -$type $ID 0 0 0 0 $SCRATCH_MNT
+			fi
+		done )&
+	done
+	wait
+	echo "### done with testing"
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux #IRIX
+_require_scratch
+_require_quota
+_need_to_be_root
+
+# real QA test starts here
+rm -f $seq.full
+
+_scratch_mkfs >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon -u -g $SCRATCH_MNT 2>/dev/null
+test_setting
+umount $SCRATCH_DEV
+
+status=0
+exit
234.out new file +4 -0
new file mode 100644
index 0000000..78d1587
@@ -0,0 +1,4 @@
+QA output created by 234
+
+### test limits and info setting
+### done with testing
group +1 -0
index cc9bdb2..3a95e48 100644
@@ -347,3 +347,4 @@ deprecated
 231 auto quota
 232 auto quota
 233 auto quota
+234 auto quota
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#24 lore raw

PATCH v3 8/8 Add test for quota accounting after remount read only

In reply to Jan Kara

Check that quota accounting works after remounting read-only and then back read-write.

---
 235     |   83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 235.out |   34 +++++++++++++++++++++++++
 group   |    1 +
 3 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100755 235
 create mode 100644 235.out
235 new file +83 -0
new file mode 100755
index 0000000..97632e5
@@ -0,0 +1,83 @@
+#! /bin/bash
+# FS QA Test No. 235
+#
+# Test whether quota gets properly reenabled after remount read-write
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2010 Jan Kara.  All Rights Reserved.
+#
+# Based on test 219,
+# Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.quota
+
+filter_scratch()
+{
+	perl -ne "
+s,$SCRATCH_MNT,[SCR_MNT],;
+s,$SCRATCH_DEV,[SCR_DEV],;
+	print;"
+}
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux #IRIX
+_require_scratch
+_require_quota
+_require_user
+_need_to_be_root
+
+# real QA test starts here
+rm -f $seq.full
+
+_scratch_mkfs >> $seq.full 2>&1
+_scratch_mount "-o usrquota,grpquota"
+quotacheck -u -g $SCRATCH_MNT 2>/dev/null
+quotaon $SCRATCH_MNT 2>/dev/null
+
+touch $SCRATCH_MNT/testfile
+chown $qa_user:$qa_user $SCRATCH_MNT/testfile
+
+repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+
+mount -o remount,ro $SCRATCH_DEV 2>&1 | tee -a $seq.full | filter_scratch
+touch $SCRATCH_MNT/failed 2>&1 | tee -a $seq.full | filter_scratch
+mount -o remount,rw $SCRATCH_DEV 2>&1 | tee -a $seq.full | filter_scratch
+
+$XFS_IO_PROG -F -c 'pwrite 0 16k' -c 'fsync' \
+			$SCRATCH_MNT/testfile >>$seq.full 2>&1
+repquota -u -g $SCRATCH_MNT  | grep -v "^root" | filter_scratch
+
+umount $SCRATCH_DEV 2>/dev/null
+
+status=0
+exit
235.out new file +34 -0
new file mode 100644
index 0000000..8d3eb1f
@@ -0,0 +1,34 @@
+QA output created by 235
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 7days; Inode grace time: 7days
+                        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 [SCR_DEV]
+Block grace time: 7days; Inode grace time: 7days
+                        Block limits                File limits
+Group           used    soft    hard  grace    used  soft  hard  grace
+----------------------------------------------------------------------
+fsgqa     --       0       0       0              1     0     0       
+
+
+touch: cannot touch `[SCR_MNT]/failed': Read-only file system
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 7days; Inode grace time: 7days
+                        Block limits                File limits
+User            used    soft    hard  grace    used  soft  hard  grace
+----------------------------------------------------------------------
+fsgqa     --      16       0       0              1     0     0       
+
+
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 7days; Inode grace time: 7days
+                        Block limits                File limits
+Group           used    soft    hard  grace    used  soft  hard  grace
+----------------------------------------------------------------------
+fsgqa     --      16       0       0              1     0     0       
+
+
group +1 -0
index 3a95e48..6b915b2 100644
@@ -348,3 +348,4 @@ deprecated
 232 auto quota
 233 auto quota
 234 auto quota
+235 auto quota quick
Signature · 6 lines
1.6.4.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs