Skip to contentSkip to conversation

xfstests: 220 - generic quota sanity

PATCH In review Eric Sandeen 4 participants 9 messages Aug 7, 2009 – Aug 11, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: 220 - generic quota sanity

Add some very basic quota sanity tests for generic filesystems.

This is based on test 108, but uses the generic quota tools, not xfs_quota, and therefore cannot test project quota.

Also, the IOs are much smaller (48k) so that ext3 won't get into indirect blocks and throw off the accounting. This does assume 4k blocks though.

---

220 new file +123 -0
new file mode 100755
index 0000000..3b828cb
@@ -0,0 +1,123 @@
+#! /bin/sh
+# FS QA Test No. 220
+#
+# Simple quota accounting test for direct/buffered/mmap IO.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2009 Eric Sandeen.  All Rights Reserved.
+#
+# Based on test 108,
+# 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
+
+test_files()
+{
+	echo; echo "### create files, setting up ownership (type=$type)"
+	rm -f $SCRATCH_MNT/{buffer,direct,mmap}
+	touch $SCRATCH_MNT/{buffer,direct,mmap}
+	chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
+	chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
+	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
+		$here/src/lstat64 $file | head -3 | filter_scratch
+	done
+}
+
+test_accounting()
+{
+	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
+	echo "--- initiating parallel IO..." >>$seq.full
+	# Small ios here because ext3 will account for indirect blocks too ...   :( 
+	# 48k will fit w/o indirect for 4k blocks (default blocksize)
+	$XFS_IO_PROG -F -c 'pwrite 0 48k' -c 'fsync' \
+					$SCRATCH_MNT/buffer >>$seq.full 2>&1 &
+	$XFS_IO_PROG -F -c 'pwrite 0 48k' -d \
+					$SCRATCH_MNT/direct >>$seq.full 2>&1 &
+	$XFS_IO_PROG -F -c 't 48k' -c 'mm -rw 0 48k' -c 'mw 0 48k' -c 'ms -s' \
+					$SCRATCH_MNT/mmap   >>$seq.full 2>&1 &
+	wait
+	echo "--- completed parallel IO ($type)" >>$seq.full
+
+	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
+		$here/src/lstat64 $file | head -3 | filter_scratch
+	done
+
+	repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch
+}
+
+# real QA test starts here
+rm -f $seq.full
+
+uid=1
+gid=2
+
+umount $SCRATCH_DEV 2>/dev/null
+_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
+umount $SCRATCH_DEV
+
+echo; echo "### test user accounting"
+export MOUNT_OPTIONS="-o usrquota"
+_qmount
+quotaon $SCRATCH_MNT 2>/dev/null
+type=u
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+echo; echo "### test group accounting"
+export MOUNT_OPTIONS="-o grpquota"
+_qmount
+quotaon $SCRATCH_MNT 2>/dev/null
+type=g
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+status=0
+exit
220.out new file +63 -0

63 lines not on this page · raw message

common.quota +15 -2
index a9dfb42..e2a7872 100644
@@ -21,14 +21,27 @@
 #
 
 #
-# checks that the XFS quota support in the kernel is enabled
+# checks that the generic quota support in the kernel is enabled
 # and that we have valid quota user tools installed.
 #
 _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"
+}
+
+#
+# checks that the XFS quota support in the kernel is enabled
+# and that we have valid quota user tools installed.
+#
+_require_xfs_quota()
+{
     src/feature -q $TEST_DEV
     [ $? -ne 0 ] && _notrun "Installed kernel does not support XFS quota"
-    [ -x /usr/sbin/xfs_quota ] || _notrun "Quota user tools not installed"
+    [ -x /usr/sbin/xfs_quota ] || _notrun "XFS quota user tools not installed"
 }
 
 #
group +1 -0
index e068e92..1fc280f 100644
@@ -328,3 +328,4 @@ prealloc
 217 log metadata auto
 218 auto fsr quick
 219 auto
+220 auto quota
050 +1 -1
index abb806a..306a7b5 100755
@@ -55,7 +55,7 @@ cp /dev/null $seq.full
 chmod a+rwx $seq.full	# arbitrary users will write here
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 bsoft=100
 bhard=500
052 +1 -1
index 16c78de..3d8bb9e 100755
@@ -54,7 +54,7 @@ _supported_os IRIX Linux
 rm -f $seq.full
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_nobody
 
 # setup a default run
054 +1 -1
index b495e51..b38efab 100755
@@ -52,7 +52,7 @@ cp /dev/null $seq.full
 chmod ugo+rwx $seq.full
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 _filter_stat()
 {
081 +1 -1
index 3036484..c8eba80 100755
@@ -54,7 +54,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # prelim
 rm -f $seq.full $tmp.*
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_v2log
  
 echo "*** init FS"
106 +1 -1
index 7154979..30f740b 100755
@@ -42,7 +42,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 # real QA test starts here
107 +1 -1
index cfa8213..f36dc21 100755
@@ -54,7 +54,7 @@ s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 # real QA test starts here
108 +1 -1
index 3f3e1fb..3a1fee9 100755
@@ -49,7 +49,7 @@ s,$SCRATCH_DEV,[SCR_DEV],;
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 test_files()
116 +1 -1
index 8394054..e902ce9 100755
@@ -51,7 +51,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 mkfs.xfs -f $SCRATCH_DEV >/dev/null 2>&1
 mount -o uquota $SCRATCH_DEV $SCRATCH_MNT
118 +1 -1
index 6b28055..cb0e5ee 100755
@@ -52,7 +52,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 _chowning_file()
 {
134 +1 -1
index fc2ab74..f00e1f0 100755
@@ -50,7 +50,7 @@ _cleanup()
 _supported_fs xfs
 _supported_os Linux IRIX
 
-_require_quota
+_require_xfs_quota
 
 dir=$SCRATCH_MNT/project
 
196 +1 -1
index 7768618..5da3659 100755
@@ -51,7 +51,7 @@ _supported_fs xfs
 _supported_os Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 #
 # Setup temporary replacements for /etc/projects and /etc/projid

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

#1 lore raw

This looks good Eric.

Is this test just for quota accounting or should it be testing quota enforcement too?

Lachlan

Quoted 414 lines · ----- "Eric Sandeen

Add some very basic quota sanity tests for generic filesystems.

This is based on test 108, but uses the generic quota tools, not xfs_quota, and therefore cannot test project quota.

Also, the IOs are much smaller (48k) so that ext3 won't get into indirect blocks and throw off the accounting. This does assume 4k blocks though.

---

220 new file +22 -0
new file mode 100755
index 0000000..3b828cb
@@ -0,0 +1,123 @@
+#! /bin/sh
+# FS QA Test No. 220
+#
+# Simple quota accounting test for direct/buffered/mmap IO.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2009 Eric Sandeen.  All Rights Reserved.
+#
+# Based on test 108,
+# 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,

220 new file +49 -0
+# 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
+
+test_files()
+{
+	echo; echo "### create files, setting up ownership (type=$type)"
+	rm -f $SCRATCH_MNT/{buffer,direct,mmap}
+	touch $SCRATCH_MNT/{buffer,direct,mmap}
+	chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
+	chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
+	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
+		$here/src/lstat64 $file | head -3 | filter_scratch
+	done
+}
+
+test_accounting()
+{
+	echo "### some controlled buffered, direct and mmapd IO

(type=$type)"

220 new file +2 -0
+	echo "--- initiating parallel IO..." >>$seq.full
+	# Small ios here because ext3 will account for indirect blocks too

... :(

220 new file +15 -1
+	# 48k will fit w/o indirect for 4k blocks (default blocksize)
+	$XFS_IO_PROG -F -c 'pwrite 0 48k' -c 'fsync' \
+					$SCRATCH_MNT/buffer >>$seq.full 2>&1 &
+	$XFS_IO_PROG -F -c 'pwrite 0 48k' -d \
+					$SCRATCH_MNT/direct >>$seq.full 2>&1 &
+	$XFS_IO_PROG -F -c 't 48k' -c 'mm -rw 0 48k' -c 'mw 0 48k' -c 'ms
-s' \
+					$SCRATCH_MNT/mmap   >>$seq.full 2>&1 &
+	wait
+	echo "--- completed parallel IO ($type)" >>$seq.full
+
+	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
+		$here/src/lstat64 $file | head -3 | filter_scratch
+	done
+
+	repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" |

filter_scratch

220 new file +35 -0
+}
+
+# real QA test starts here
+rm -f $seq.full
+
+uid=1
+gid=2
+
+umount $SCRATCH_DEV 2>/dev/null
+_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
+umount $SCRATCH_DEV
+
+echo; echo "### test user accounting"
+export MOUNT_OPTIONS="-o usrquota"
+_qmount
+quotaon $SCRATCH_MNT 2>/dev/null
+type=u
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+echo; echo "### test group accounting"
+export MOUNT_OPTIONS="-o grpquota"
+_qmount
+quotaon $SCRATCH_MNT 2>/dev/null
+type=g
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+status=0
+exit
220.out new file +28 -0
new file mode 100644
index 0000000..57db113
@@ -0,0 +1,63 @@
+QA output created by 220
+
+### test user accounting
+
+### create files, setting up ownership (type=u)
+  File: "[SCR_MNT]/buffer"
+  Size: 0            Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/direct"
+  Size: 0            Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/mmap"
+  Size: 0            Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+### some controlled buffered, direct and mmapd IO (type=u)
+  File: "[SCR_MNT]/buffer"
+  Size: 53248        Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/direct"
+  Size: 53248        Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/mmap"
+  Size: 53248        Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+*** 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
+----------------------------------------------------------------------

220.out new file +30 -0
+#1        --     168       0       0              3     0     0      
 
+
+
+
+### test group accounting
+
+### create files, setting up ownership (type=g)
+  File: "[SCR_MNT]/buffer"
+  Size: 0            Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/direct"
+  Size: 0            Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/mmap"
+  Size: 0            Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+### some controlled buffered, direct and mmapd IO (type=g)
+  File: "[SCR_MNT]/buffer"
+  Size: 53248        Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/direct"
+  Size: 53248        Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+  File: "[SCR_MNT]/mmap"
+  Size: 53248        Filetype: Regular File
+  Mode: (0644/-rw-r--r--)         Uid: (1)  Gid: (2)
+*** 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
+----------------------------------------------------------------------

220.out new file +3 -0
+#2        --     168       0       0              3     0     0      
 
+
+
common.quota +2 -1
index a9dfb42..e2a7872 100644
@@ -21,14 +21,27 @@
 #
 
 #
-# checks that the XFS quota support in the kernel is enabled
+# checks that the generic quota support in the kernel is enabled
 # and that we have valid quota user tools installed.
 #
 _require_quota()
 {
+    [ -x /usr/bin/quota ] || _notrun "Quota user tools not

installed"

common.quota +4 -0
+    _scratch_mount "-o usrquota,grpquota"
+    ret=$?
+    umount $SCRATCH_MNT
+    [ $ret -ne 0 ] && _notrun "Installed kernel does not support

quota"

common.quota +8 -0
+}
+
+#
+# checks that the XFS quota support in the kernel is enabled
+# and that we have valid quota user tools installed.
+#
+_require_xfs_quota()
+{
     src/feature -q $TEST_DEV
     [ $? -ne 0 ] && _notrun "Installed kernel does not support XFS

quota"
- [ -x /usr/sbin/xfs_quota ] || _notrun "Quota user tools not
installed"
+ [ -x /usr/sbin/xfs_quota ] || _notrun "XFS quota user tools not
installed"
}

#

group +1 -0
index e068e92..1fc280f 100644
@@ -328,3 +328,4 @@ prealloc
 217 log metadata auto
 218 auto fsr quick
 219 auto
+220 auto quota
050 +1 -1
index abb806a..306a7b5 100755
@@ -55,7 +55,7 @@ cp /dev/null $seq.full
 chmod a+rwx $seq.full	# arbitrary users will write here
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 bsoft=100
 bhard=500
052 +1 -1
index 16c78de..3d8bb9e 100755
@@ -54,7 +54,7 @@ _supported_os IRIX Linux
 rm -f $seq.full
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_nobody
 
 # setup a default run
054 +1 -1
index b495e51..b38efab 100755
@@ -52,7 +52,7 @@ cp /dev/null $seq.full
 chmod ugo+rwx $seq.full
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 _filter_stat()
 {
081 +1 -1
index 3036484..c8eba80 100755
@@ -54,7 +54,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # prelim
 rm -f $seq.full $tmp.*
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_v2log
 
 echo "*** init FS"
106 +1 -1
index 7154979..30f740b 100755
@@ -42,7 +42,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 # real QA test starts here
107 +1 -1
index cfa8213..f36dc21 100755
@@ -54,7 +54,7 @@ s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode:
 #[INO] (X blocks, Y extents)/;
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 # real QA test starts here
108 +1 -1
index 3f3e1fb..3a1fee9 100755
@@ -49,7 +49,7 @@ s,$SCRATCH_DEV,[SCR_DEV],;
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 test_files()
116 +1 -1
index 8394054..e902ce9 100755
@@ -51,7 +51,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 mkfs.xfs -f $SCRATCH_DEV >/dev/null 2>&1
 mount -o uquota $SCRATCH_DEV $SCRATCH_MNT
118 +1 -1
index 6b28055..cb0e5ee 100755
@@ -52,7 +52,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 _chowning_file()
 {
134 +1 -1
index fc2ab74..f00e1f0 100755
@@ -50,7 +50,7 @@ _cleanup()
 _supported_fs xfs
 _supported_os Linux IRIX
 
-_require_quota
+_require_xfs_quota
 
 dir=$SCRATCH_MNT/project
 
196 +1 -1
index 7768618..5da3659 100755
@@ -51,7 +51,7 @@ _supported_fs xfs
 _supported_os Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 #
 # Setup temporary replacements for /etc/projects and /etc/projid
Quoted 4 lines

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

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

#2 lore raw
Quoted 4 lines · Lachlan McIlroy

This looks good Eric.

Is this test just for quota accounting or should it be testing quota enforcement too?

I guess 108 just did accounting; I was going to keep it parallel, and do a different one for accounting, but it could be added to this as well.

-Eric

Quoted 15 lines

Lachlan

Quoted 11 lines · ----- "Eric Sandeen

Add some very basic quota sanity tests for generic filesystems.

This is based on test 108, but uses the generic quota tools, not xfs_quota, and therefore cannot test project quota.

Also, the IOs are much smaller (48k) so that ext3 won't get into indirect blocks and throw off the accounting. This does assume 4k blocks though.

---

...

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

#5 lore raw

PATCH v2 1/2 xfstests: split out xfs & generic quota existence tests

In reply to Eric Sandeen

Split out xfs & generic quota existence tests

Make a new test to test for generic quota tools, for generic filesystem testing. Move the existing quota test to a new "xfs" name.

---

common.quota +15 -2
index a9dfb42..e2a7872 100644
@@ -21,14 +21,27 @@
 #
 
 #
-# checks that the XFS quota support in the kernel is enabled
+# checks that the generic quota support in the kernel is enabled
 # and that we have valid quota user tools installed.
 #
 _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"
+}
+
+#
+# checks that the XFS quota support in the kernel is enabled
+# and that we have valid quota user tools installed.
+#
+_require_xfs_quota()
+{
     src/feature -q $TEST_DEV
     [ $? -ne 0 ] && _notrun "Installed kernel does not support XFS quota"
-    [ -x /usr/sbin/xfs_quota ] || _notrun "Quota user tools not installed"
+    [ -x /usr/sbin/xfs_quota ] || _notrun "XFS quota user tools not installed"
 }
 
 #diff --git a/050 b/050

index abb806a..306a7b5 100755

050 +1 -1
@@ -55,7 +55,7 @@ cp /dev/null $seq.full
 chmod a+rwx $seq.full	# arbitrary users will write here
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 bsoft=100
 bhard=500
052 +1 -1
index 16c78de..3d8bb9e 100755
@@ -54,7 +54,7 @@ _supported_os IRIX Linux
 rm -f $seq.full
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_nobody
 
 # setup a default run
054 +1 -1
index b495e51..b38efab 100755
@@ -52,7 +52,7 @@ cp /dev/null $seq.full
 chmod ugo+rwx $seq.full
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 _filter_stat()
 {
081 +1 -1
index 3036484..c8eba80 100755
@@ -54,7 +54,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 # prelim
 rm -f $seq.full $tmp.*
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_v2log
  
 echo "*** init FS"
106 +1 -1
index 7154979..30f740b 100755
@@ -42,7 +42,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 # real QA test starts here
107 +1 -1
index cfa8213..f36dc21 100755
@@ -54,7 +54,7 @@ s/Inode: \#\d+ \(\d+ blocks, \d+ extents\)/Inode: #[INO] (X blocks, Y extents)/;
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 # real QA test starts here
108 +1 -1
index 3f3e1fb..3a1fee9 100755
@@ -49,7 +49,7 @@ s,$SCRATCH_DEV,[SCR_DEV],;
 _supported_fs xfs
 _supported_os Linux #IRIX
 _require_scratch
-_require_quota
+_require_xfs_quota
 _require_prjquota
 
 test_files()
116 +1 -1
index 8394054..e902ce9 100755
@@ -51,7 +51,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 mkfs.xfs -f $SCRATCH_DEV >/dev/null 2>&1
 mount -o uquota $SCRATCH_DEV $SCRATCH_MNT
118 +1 -1
index 6b28055..cb0e5ee 100755
@@ -52,7 +52,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 _chowning_file()
 {
134 +1 -1
index fc2ab74..f00e1f0 100755
@@ -50,7 +50,7 @@ _cleanup()
 _supported_fs xfs
 _supported_os Linux IRIX
 
-_require_quota
+_require_xfs_quota
 
 dir=$SCRATCH_MNT/project
 
196 +1 -1
index 7768618..5da3659 100755
@@ -51,7 +51,7 @@ _supported_fs xfs
 _supported_os Linux
 
 _require_scratch
-_require_quota
+_require_xfs_quota
 
 #
 # Setup temporary replacements for /etc/projects and /etc/projid

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

#7 lore raw

PATCH v2 2/2 xfstests: 220 - generic quota sanity

In reply to Eric Sandeen

Add some very basic quota sanity tests for generic filesystems.

This is based on test 108, but uses the generic quota tools, not xfs_quota, and therefore cannot test project quota.

Also, the IOs are much smaller (48k) so that ext3 won't get into indirect blocks and throw off the accounting. This does assume 4k blocks though.

---

V2: xfs test changes split out, fix 220.out for 12-block IO

220 new file +123 -0
new file mode 100644
index 0000000..3b828cb
@@ -0,0 +1,123 @@
+#! /bin/sh
+# FS QA Test No. 220
+#
+# Simple quota accounting test for direct/buffered/mmap IO.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2009 Eric Sandeen.  All Rights Reserved.
+#
+# Based on test 108,
+# 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
+
+test_files()
+{
+	echo; echo "### create files, setting up ownership (type=$type)"
+	rm -f $SCRATCH_MNT/{buffer,direct,mmap}
+	touch $SCRATCH_MNT/{buffer,direct,mmap}
+	chown $uid $SCRATCH_MNT/{buffer,direct,mmap}
+	chgrp $gid $SCRATCH_MNT/{buffer,direct,mmap}
+	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
+		$here/src/lstat64 $file | head -3 | filter_scratch
+	done
+}
+
+test_accounting()
+{
+	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
+	echo "--- initiating parallel IO..." >>$seq.full
+	# Small ios here because ext3 will account for indirect blocks too ...   :( 
+	# 48k will fit w/o indirect for 4k blocks (default blocksize)
+	$XFS_IO_PROG -F -c 'pwrite 0 48k' -c 'fsync' \
+					$SCRATCH_MNT/buffer >>$seq.full 2>&1 &
+	$XFS_IO_PROG -F -c 'pwrite 0 48k' -d \
+					$SCRATCH_MNT/direct >>$seq.full 2>&1 &
+	$XFS_IO_PROG -F -c 't 48k' -c 'mm -rw 0 48k' -c 'mw 0 48k' -c 'ms -s' \
+					$SCRATCH_MNT/mmap   >>$seq.full 2>&1 &
+	wait
+	echo "--- completed parallel IO ($type)" >>$seq.full
+
+	for file in $SCRATCH_MNT/{buffer,direct,mmap}; do
+		$here/src/lstat64 $file | head -3 | filter_scratch
+	done
+
+	repquota -$type -s -n $SCRATCH_MNT  | grep -v "^#0" | filter_scratch
+}
+
+# real QA test starts here
+rm -f $seq.full
+
+uid=1
+gid=2
+
+umount $SCRATCH_DEV 2>/dev/null
+_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
+umount $SCRATCH_DEV
+
+echo; echo "### test user accounting"
+export MOUNT_OPTIONS="-o usrquota"
+_qmount
+quotaon $SCRATCH_MNT 2>/dev/null
+type=u
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+echo; echo "### test group accounting"
+export MOUNT_OPTIONS="-o grpquota"
+_qmount
+quotaon $SCRATCH_MNT 2>/dev/null
+type=g
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+status=0
+exit
220.out new file +63 -0

63 lines not on this page · raw message

group +1 -0
index e068e92..1fc280f 100644
@@ -328,3 +328,4 @@ prealloc
 217 log metadata auto
 218 auto fsr quick
 219 auto
+220 auto quota

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

Reviewed-by on v2 1/2
#6 lore raw

Re: [PATCH V2 1/2] xfstests: split out xfs & generic quota existence tests

In reply to Eric Sandeen
Quoted 5 lines · Eric Sandeen

Split out xfs & generic quota existence tests

Make a new test to test for generic quota tools, for generic filesystem testing. Move the existing quota test to a new "xfs" name.

Looks good,

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

Reviewed-by on v2 2/2
#8 lore raw
In reply to Eric Sandeen
Quoted 8 lines · Eric Sandeen

Add some very basic quota sanity tests for generic filesystems.

This is based on test 108, but uses the generic quota tools, not xfs_quota, and therefore cannot test project quota.

Also, the IOs are much smaller (48k) so that ext3 won't get into indirect blocks and throw off the accounting. This does assume 4k blocks though.

Looks good to me and passes at least for XFS.

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

#3 lore raw
In reply to Eric Sandeen
Quoted 8 lines · Eric Sandeen
Quoted 4 lines · Lachlan McIlroy

This looks good Eric.

Is this test just for quota accounting or should it be testing quota enforcement too?

I guess 108 just did accounting; I was going to keep it parallel, and do a different one for accounting, but it could be added to this as well.

Yeah, let's use a different one for enforement testing.

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

#4 lore raw
Quoted 6 lines · ----- "Christoph Hellwig
Quoted 4 lines · Eric Sandeen
Quoted 3 lines · Lachlan McIlroy

This looks good Eric.

Is this test just for quota accounting or should it be testing

quota

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

enforcement too?

I guess 108 just did accounting; I was going to keep it parallel,

and do

Quoted 1 line

a different one for accounting, but it could be added to this as

well.

Yeah, let's use a different one for enforement testing.

Agree, if quota enforcement isn't working correctly then the accounting is the first thing to check so having seperate tests is a good idea.

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