Skip to contentSkip to conversation

Quota tests for XFSQA

PATCH Superseded Jan Kara 3 participants 20 messages May 19, 2010 – May 20, 2010

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
author
#1 lore raw

PATCH v2 1/7 xfstests: test extent size hints

From: Christoph Hellwig <[email protected]>

This is an adapted version of the reproduced in OSS BZ #874, which shows file corruption when using the extent size hint.

---
 229           |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 229.out       |    4 ++
 group         |    1 +
 src/Makefile  |    2 +-
 src/t_holes.c |   41 ++++++++++++++++++++++++++
 5 files changed, 135 insertions(+), 1 deletions(-)
 create mode 100644 229
 create mode 100644 229.out
 create mode 100644 src/t_holes.c
229 new file +88 -0
new file mode 100644
index 0000000..418a5af
@@ -0,0 +1,88 @@
+#! /bin/bash
+# FS QA Test No. 221
+#
+# Check for file corruption when using the extent size hint on
+# the normal data subvolume.
+#
+# http://oss.sgi.com/bugzilla/show_bug.cgi?id=874
+#
+# Based on a bug report and testcase from Geoffrey Wehrman <[email protected]>.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2010 Christoph Hellwig.  All Rights Reserved.
+# Copyright (c) 2010 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!
+
+_cleanup()
+{
+    rm -rf ${TDIR}
+}
+
+trap "_cleanup ; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+
+TDIR="${TEST_DIR}/t_holes"
+NFILES="10"
+EXTSIZE="256k"
+
+# Create the test directory
+mkdir ${TDIR}
+
+# Set the test directory extsize
+xfs_io -c "extsize ${EXTSIZE}" ${TDIR}
+
+# Create a set of holey files
+echo "generating ${NFILES} files"
+
+for i in $(seq 0 ${NFILES}); do
+  $here/src/t_holes ${TDIR}/${i}
+done
+
+# Compare the files
+echo "comparing files"
+errcnt=0
+j=0
+for i in $(seq 0 ${NFILES}); do
+    let j=$i+1
+    while [ ${j} -lt ${NFILES} ] ; do
+	if ! cmp ${TDIR}/${i} ${TDIR}/${j} ; then
+	    let errcnt=$errcnt+1
+	fi
+	let j=$j+1
+    done
+done
+
+echo "got ${errcnt} errors"
+
+status=$errcnt
+exit $status
229.out new file +4 -0
new file mode 100644
index 0000000..233920f
@@ -0,0 +1,4 @@
+QA output created by 229
+generating 10 files
+comparing files
+got 0 errors
group +1 -0
index 69ba24d..2c1ac50 100644
@@ -342,3 +342,4 @@ deprecated
 226 auto enospc
 227 auto fsr
 228 rw auto prealloc quick
+229 auto rw
src/Makefile +1 -1
index 2f95fe2..976133d 100644
@@ -10,7 +10,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
 	mmapcat append_reader append_writer dirperf metaperf \
 	devzero feature alloc fault fstest t_access_root \
 	godown resvtest writemod makeextents itrash rename \
-	multi_open_unlink dmiperf unwritten_sync genhashnames
+	multi_open_unlink dmiperf unwritten_sync genhashnames t_holes
 
 LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/t_holes.c new file +41 -0

41 lines not on this page · raw message

Signature · 6 lines
1.6.4.2

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

Re: [PATCH 1/7] xfstests: test extent size hints

Quoted 1 line · Christoph Hellwig

I think you included one patch too many in your series, this was already

Yes, I've noticed that as well. Sorry for that.

Quoted 2 lines

applied. Btw, if you have this in a git tree making that available would ease testing a bit.

OK. It's at
git://git.kernel.org/pub/scm/linux/kernel/git/jack/xfstests-dev/
in branch quota-tests
(I know it's inappropriate place but I'm too lazy to setup the repository
somewhere else ;).

Honza

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

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

PATCH v2 2/7 Fix test whether kernel supports quotas

In reply to Jan Kara

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 |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
common.quota +1 -4
index 51bdc71..033390f 100644
@@ -27,10 +27,7 @@
 _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"
+    [ -d /proc/sys/fs/quota ] || _notrun "Installed kernel does not support quota"
 }
 
 #
Signature · 6 lines
1.6.4.2

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

Re: [PATCH 2/7] Fix test whether kernel supports quotas

Quoted 4 lines · Jan Kara

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

It's not actually correct. /proc/sys/fs/quota only gets registered by fs/quota/dquot.c, which means it's not avaiable in a kernel that only has XFS quotas.

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

author
#6 lore raw

Re: [PATCH 2/7] Fix test whether kernel supports quotas

Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Jan Kara

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

It's not actually correct. /proc/sys/fs/quota only gets registered by fs/quota/dquot.c, which means it's not avaiable in a kernel that only has XFS quotas.

Ah, I was convinced that _require_quota() should check whether VFS
quotas are enabled but apparently it should work also for XFS. So would test like below be OK?

if [ $FSTYP = "xfs" ]; then

    [ -f /proc/fs/xfs/xqmstat ] || _notrun "Installed kernel does not support XFS quota"
else
    [ -d /proc/sys/fs/quota ] || _notrun "Installed kernel does not support quota"

fi

Honza

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 2/7] Fix test whether kernel supports quotas

Quoted 14 lines · Jan Kara
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Jan Kara

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

It's not actually correct. /proc/sys/fs/quota only gets registered by fs/quota/dquot.c, which means it's not avaiable in a kernel that only has XFS quotas.

Ah, I was convinced that _require_quota() should check whether VFS
quotas are enabled but apparently it should work also for XFS. So would test like below be OK?

Quoted 5 lines

if [ $FSTYP = "xfs" ]; then

    [ -f /proc/fs/xfs/xqmstat ] || _notrun "Installed kernel does not support XFS quota"
else
    [ -d /proc/sys/fs/quota ] || _notrun "Installed kernel does not support quota"

fi

That would still fail for GFS2.

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

author
#8 lore raw

Re: [PATCH 2/7] Fix test whether kernel supports quotas

Quoted 15 lines · Christoph Hellwig
Quoted 14 lines · Jan Kara
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Jan Kara

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

It's not actually correct. /proc/sys/fs/quota only gets registered by fs/quota/dquot.c, which means it's not avaiable in a kernel that only has XFS quotas.

Ah, I was convinced that _require_quota() should check whether VFS
quotas are enabled but apparently it should work also for XFS. So would test like below be OK?

Quoted 7 lines
Quoted 5 lines

if [ $FSTYP = "xfs" ]; then

    [ -f /proc/fs/xfs/xqmstat ] || _notrun "Installed kernel does not support XFS quota"
else
    [ -d /proc/sys/fs/quota ] || _notrun "Installed kernel does not support quota"

fi

That would still fail for GFS2.

OK, still easy to fix ;)
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

Anything else? This filesystem type testing isn't too nice but the only
other way of fixing the old check is by running _scratch_mkfs before it and that takes long...

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 v2 3/7 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..a63e004
@@ -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}
+	chown $qa_user $SCRATCH_MNT/file{1,2}
+	chgrp $qa_user $SCRATCH_MNT/file{1,2}
+	chmod 777 $SCRATCH_MNT
+}
+
+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 |
+							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 | 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 |
+			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
#10 lore raw

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

The golden output contains "/local/test1/file5" which appaears to be in your test fs. You need to do something like

sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"

or

	sed -e "s,$T�T_MNT,TEST_MNT,g"

to make the test portable. This probably applies to the other tests as well.

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

author
#11 lore raw

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

Quoted 11 lines · Christoph Hellwig

The golden output contains "/local/test1/file5" which appaears to be in your test fs. You need to do something like

sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"

or

	sed -e "s,$T�T_MNT,TEST_MNT,g"

to make the test portable. This probably applies to the other tests as well.

I have filter_scratch function for this in all tests. I just forgot to
filter output of touch(1) through it. It should be fixed now.
BTW: What is the purpose of 'status' variable? I set it to 1 if I want
the test to fail because diff found differences between accounted and real usage. Is this correct? Actually, diff will also print the differences to stdout so setting status probably shouldn't be needed. So is it preferred to set status to 1 or leave it 0?

Honza

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

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

author
#12 lore raw

PATCH v2 4/7 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     |  139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 231.out |   10 +++++
 group   |    1 +
 3 files changed, 150 insertions(+), 0 deletions(-)
 create mode 100755 231
 create mode 100644 231.out
231 new file +139 -0
new file mode 100755
index 0000000..0e34d33
@@ -0,0 +1,139 @@
+#! /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 -S 191110531 -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
+		su $qa_user -c "ltp/fsx $FSX_ARGS $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
+			wait
+			return 1
+		fi
+		$XFS_IO_PROG -F -c 'fsync' $SCRATCH_MNT/fsx_file$i
+		cat $tmp.output$i
+	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
#13 lore raw

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

Quoted 50 lines · Jan Kara

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

---
 231     |  139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 231.out |   10 +++++
 group   |    1 +
 3 files changed, 150 insertions(+), 0 deletions(-)
 create mode 100755 231
 create mode 100644 231.out
231 new file +32 -0
new file mode 100755
index 0000000..0e34d33
@@ -0,0 +1,139 @@
+#! /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/$$

231 line 42

Quoted 10 lines
231 new file +10 -0
+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 20000"

My only question about this test is the use of a fixed seed for the test - shouldn't we randomise it and save the seed to $seq.full? This will results in different combinations of operations being tested (better long term coverage), but we still have the seed available to try to reproduce failures if they are based on a specific pattern of ops...

As it stands, this would still be fine with a fixed seed...

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

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

Quoted 60 lines · Dave Chinner
Quoted 59 lines · Jan Kara

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

---
 231     |  139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 231.out |   10 +++++
 group   |    1 +
 3 files changed, 150 insertions(+), 0 deletions(-)
 create mode 100755 231
 create mode 100644 231.out
231 new file +41 -0
new file mode 100755
index 0000000..0e34d33
@@ -0,0 +1,139 @@
+#! /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
Quoted 8 lines

231 line 42

Quoted 1 line
231 new file +1 -0
+FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 20000"

My only question about this test is the use of a fixed seed for the test - shouldn't we randomise it and save the seed to $seq.full? This will results in different combinations of operations being tested (better long term coverage), but we still have the seed available to try to reproduce failures if they are based on a specific pattern of ops...

Ah, that's a great idea. I wanted a reproducible testcase so I
chose fixed seed but I forgot I could save it in $seq.full. I'll change the test to work this way.

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

PATCH v2 5/7 Add quota test with fsstress

In reply to Jan Kara

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

---
 232     |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 232.out |    6 +++
 group   |    1 +
 3 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100755 232
 create mode 100644 232.out
232 new file +118 -0
new file mode 100755
index 0000000..ef8ce8a
@@ -0,0 +1,118 @@
+#! /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
+
+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=2000
+	args="-n $count -d $out -p 7"
+
+	echo "fsstress $args" | sed -e "s#$out#outdir#"
+	if ! $FSSTRESS_PROG $args | _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
#16 lore raw

Re: [PATCH 5/7] Add quota test with fsstress

Quoted 23 lines · Jan Kara

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

---
 232     |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 232.out |    6 +++
 group   |    1 +
 3 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100755 232
 create mode 100644 232.out
232 new file +6 -0
new file mode 100755
index 0000000..ef8ce8a
@@ -0,0 +1,118 @@
+#! /bin/bash
+# FSQA Test No. 232
+#
+# Run fsstress with quotas enabled and verify accounted quotas in the end
+#
+# Derived from test 231

....

232 line 42

Quoted 2 lines
232 new file +2 -0
+FSX_FILE_SIZE=64000000
+FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"

These look like left overs from a copy-n-paste ;)

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Re: [PATCH 5/7] Add quota test with fsstress

Quoted 25 lines · Dave Chinner
Quoted 23 lines · Jan Kara

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

---
 232     |  118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 232.out |    6 +++
 group   |    1 +
 3 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100755 232
 create mode 100644 232.out
232 new file +6 -0
new file mode 100755
index 0000000..ef8ce8a
@@ -0,0 +1,118 @@
+#! /bin/bash
+# FSQA Test No. 232
+#
+# Run fsstress with quotas enabled and verify accounted quotas in the end
+#
+# Derived from test 231

....

Quoted 4 lines

232 line 42

Quoted 2 lines
232 new file +2 -0
+FSX_FILE_SIZE=64000000
+FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"

These look like left overs from a copy-n-paste ;)

Yup. Fixed.

Honza

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

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

PATCH v2 6/7 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..1185a6d
@@ -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" | sed -e "s#$out#outdir#"
+	if ! su $qa_user -c "$FSSTRESS_PROG $args" | _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
#19 lore raw

PATCH v2 7/7 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     |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 234.out |    4 ++
 group   |    1 +
 3 files changed, 111 insertions(+), 0 deletions(-)
 create mode 100755 234
 create mode 100644 234.out
234 new file +106 -0
new file mode 100755
index 0000000..84604eb
@@ -0,0 +1,106 @@
+#! /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
+
+	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%$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