From c9ff0c04476af68c93a120bb6f16c2a0182788ea Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 19 May 2010 11:25:52 +0200 Subject: [PATCH 1/9] 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). Signed-off-by: Jan Kara --- common.quota | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common.quota b/common.quota index 51bdc71b..d32e285b 100644 --- a/common.quota +++ b/common.quota @@ -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 } # From 2a7c4917c977bc040bfced0a28aaa3f52c05a2e0 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Mon, 24 May 2010 11:46:44 +0200 Subject: [PATCH 2/9] Fix fallocate() test 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. Signed-off-by: Jan Kara --- common.rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common.rc b/common.rc index e6d818d0..6bf1e127 100644 --- a/common.rc +++ b/common.rc @@ -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" && \ From a764d7b39f6e7025d30f0180f4241b101799eb88 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 18 May 2010 23:26:57 +0200 Subject: [PATCH 3/9] Test basic quota enforcement Add a test which checks whether basic quota enforcement works. Signed-off-by: Jan Kara --- 230 | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 230.out | 33 ++++++++++++ group | 1 + 3 files changed, 189 insertions(+) create mode 100755 230 create mode 100644 230.out diff --git a/230 b/230 new file mode 100755 index 00000000..fb356731 --- /dev/null +++ b/230 @@ -0,0 +1,155 @@ +#! /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 +owner=jack@suse.cz + +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 + echo "Write 900k..." + su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 900k' -c fsync \ + $SCRATCH_MNT/file1" 2>&1 >>$seq.full | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + # Secondly overcome block soft limit + echo "Rewrite 1001k..." + su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 1001k' -c fsync \ + $SCRATCH_MNT/file1" 2>&1 >>$seq.full | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + # Now try to overcome block hardlimit + echo "Write 1000k..." + su $qa_user -c "$XFS_IO_PROG -F -c 'pwrite 0 1000k' -c fsync \ + $SCRATCH_MNT/file2" 2>&1 >>$seq.full | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + # Now sleep for grace time and check that softlimit got enforced + sleep $((grace+1)) + echo "Write 4096..." + su $qa_user -c "$XFS_IO_PROG -F -c 'truncate 0' -c 'pwrite 0 4096' \ + $SCRATCH_MNT/file2" 2>&1 >>$seq.full | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + # And now the softlimit test for inodes + # First reset space limits so that we don't have problems with + # space reservations on XFS + setquota -$type $qa_user 0 0 3 5 $SCRATCH_MNT + echo "Touch 3+4" + su $qa_user -c "touch $SCRATCH_MNT/file3 $SCRATCH_MNT/file4" \ + 2>&1 >>$seq.full | filter_scratch | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + # Try to exceed inode hardlimit + echo "Touch 5+6" + su $qa_user -c "touch $SCRATCH_MNT/file5 $SCRATCH_MNT/file6" \ + 2>&1 >>$seq.full | filter_scratch | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + # Wait and check grace time enforcement + rm -f $SCRATCH_MNT/file5 >>$seq.full 2>&1 + sleep $((grace+1)) + echo "Touch 5" + su $qa_user -c "touch $SCRATCH_MNT/file5" 2>&1 >>$seq.full | + filter_scratch | tee -a $seq.full + repquota -$type $SCRATCH_MNT | grep -v "^root" >>$seq.full 2>&1 + echo "--- completed IO ($type)" >>$seq.full +} + +cleanup_files() +{ + rm -f $SCRATCH_MNT/file{1,2,3,4,5,6} +} + +# 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 1000 2000 3 5 $SCRATCH_MNT +setquota -u -t $grace $grace $SCRATCH_MNT +setquota -g $qa_user 1000 2000 3 5 $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 diff --git a/230.out b/230.out new file mode 100644 index 00000000..10dd50ce --- /dev/null +++ b/230.out @@ -0,0 +1,33 @@ +QA output created by 230 + +### test user limit enforcement + +### create files, setting up ownership (type=u) +### some buffered IO (type=u) +Write 900k... +Rewrite 1001k... +Write 1000k... +pwrite64: Disk quota exceeded +Write 4096... +pwrite64: Disk quota exceeded +Touch 3+4 +Touch 5+6 +touch: cannot touch `[SCR_MNT]/file6': Disk quota exceeded +Touch 5 +touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded + +### test group limit enforcement + +### create files, setting up ownership (type=g) +### some buffered IO (type=g) +Write 900k... +Rewrite 1001k... +Write 1000k... +pwrite64: Disk quota exceeded +Write 4096... +pwrite64: Disk quota exceeded +Touch 3+4 +Touch 5+6 +touch: cannot touch `[SCR_MNT]/file6': Disk quota exceeded +Touch 5 +touch: cannot touch `[SCR_MNT]/file5': Disk quota exceeded diff --git a/group b/group index 2c1ac50c..441e0e96 100644 --- a/group +++ b/group @@ -343,3 +343,4 @@ deprecated 227 auto fsr 228 rw auto prealloc quick 229 auto rw +230 auto quota quick From d3714f7f760148a646684c9bc07f0eb5cd38880d Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 19 May 2010 01:00:21 +0200 Subject: [PATCH 4/9] Add test of quota accounting using fsx Run fsx (and also several fsx threads in parallel) and verify that quota accounting is correct after they finish. Signed-off-by: Jan Kara --- 231 | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 231.out | 10 ++++ group | 1 + 3 files changed, 152 insertions(+) create mode 100755 231 create mode 100644 231.out diff --git a/231 b/231 new file mode 100755 index 00000000..ebbe11e5 --- /dev/null +++ b/231 @@ -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 +owner=jack@suse.cz + +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 diff --git a/231.out b/231.out new file mode 100644 index 00000000..2f2d0723 --- /dev/null +++ b/231.out @@ -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! diff --git a/group b/group index 441e0e96..6b59c696 100644 --- a/group +++ b/group @@ -344,3 +344,4 @@ deprecated 228 rw auto prealloc quick 229 auto rw 230 auto quota quick +231 auto quota From bb1911020fdfb122fae96154fced6e975e68674a Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 19 May 2010 01:22:13 +0200 Subject: [PATCH 5/9] Add quota test with fsstress Run fsstress and verify that quota accounting is correct after it finishes. Signed-off-by: Jan Kara --- 232 | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 232.out | 6 +++ group | 1 + 3 files changed, 122 insertions(+) create mode 100755 232 create mode 100644 232.out diff --git a/232 b/232 new file mode 100755 index 00000000..cf4d25ad --- /dev/null +++ b/232 @@ -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 +owner=jack@suse.cz + +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 diff --git a/232.out b/232.out new file mode 100644 index 00000000..744192ec --- /dev/null +++ b/232.out @@ -0,0 +1,6 @@ +QA output created by 232 + +Testing fsstress + +fsstress -n 2000 -d outdir -p 7 +seed = S diff --git a/group b/group index 6b59c696..c8cd7743 100644 --- a/group +++ b/group @@ -345,3 +345,4 @@ deprecated 229 auto rw 230 auto quota quick 231 auto quota +232 auto quota From 73bce8731979f36d8d9e7ee6efe2fd00c74b1570 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 19 May 2010 13:00:36 +0200 Subject: [PATCH 6/9] Add quota accounting test when fsstress is run and quota limits are set low Test various error recovery paths whether they properly handle EDQUOT failures. Signed-off-by: Jan Kara --- 233 | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 233.out | 6 +++ group | 1 + 3 files changed, 131 insertions(+) create mode 100755 233 create mode 100644 233.out diff --git a/233 b/233 new file mode 100755 index 00000000..b967e0d1 --- /dev/null +++ b/233 @@ -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 +owner=jack@suse.cz + +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 diff --git a/233.out b/233.out new file mode 100644 index 00000000..208910d7 --- /dev/null +++ b/233.out @@ -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 diff --git a/group b/group index c8cd7743..cc9bdb23 100644 --- a/group +++ b/group @@ -346,3 +346,4 @@ deprecated 230 auto quota quick 231 auto quota 232 auto quota +233 auto quota From 55198907bbc577957c8cd518ff71fd170bb485d4 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 19 May 2010 15:12:01 +0200 Subject: [PATCH 7/9] Add test of quota limit and info setting Add test stressing addition and removal of quota structures and setting of quota grace time. Signed-off-by: Jan Kara --- 234 | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 234.out | 4 +++ group | 1 + 3 files changed, 113 insertions(+) create mode 100755 234 create mode 100644 234.out diff --git a/234 b/234 new file mode 100755 index 00000000..4e98035c --- /dev/null +++ b/234 @@ -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 +owner=jack@suse.cz + +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 diff --git a/234.out b/234.out new file mode 100644 index 00000000..78d15873 --- /dev/null +++ b/234.out @@ -0,0 +1,4 @@ +QA output created by 234 + +### test limits and info setting +### done with testing diff --git a/group b/group index cc9bdb23..3a95e48e 100644 --- a/group +++ b/group @@ -347,3 +347,4 @@ deprecated 231 auto quota 232 auto quota 233 auto quota +234 auto quota From 20530a3062c210a03191dc13432f5f573cf18af4 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Mon, 24 May 2010 12:04:56 +0200 Subject: [PATCH 8/9] Add test for quota accounting after remount read only Check that quota accounting works after remounting read-only and then back read-write. Signed-off-by: Jan Kara --- 235 | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 235.out | 34 +++++++++++++++++++++++ group | 1 + 3 files changed, 118 insertions(+) create mode 100755 235 create mode 100644 235.out diff --git a/235 b/235 new file mode 100755 index 00000000..97632e55 --- /dev/null +++ b/235 @@ -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 +owner=jack@suse.cz + +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 diff --git a/235.out b/235.out new file mode 100644 index 00000000..8d3eb1f7 --- /dev/null +++ b/235.out @@ -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 + + diff --git a/group b/group index 3a95e48e..6b915b2f 100644 --- a/group +++ b/group @@ -348,3 +348,4 @@ deprecated 232 auto quota 233 auto quota 234 auto quota +235 auto quota quick From fb0eb99cb44ee5decd8db82e358bc011c497d213 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 25 May 2010 18:25:53 +0200 Subject: [PATCH 9/9] Make test 229 XFS specific Only XFS supports directory 'extsize' feature. Signed-off-by: Jan Kara --- 229 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/229 b/229 index 418a5af2..81a2491d 100644 --- a/229 +++ b/229 @@ -48,7 +48,7 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15 . ./common.rc # real QA test starts here -_supported_fs generic +_supported_fs xfs _supported_os Linux TDIR="${TEST_DIR}/t_holes"