* [PATCH 1/7] xfstests: test extent size hints
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
2010-05-20 15:01 ` Christoph Hellwig
2010-05-19 13:38 ` [PATCH 2/7] Fix test whether kernel supports quotas Jan Kara
` (5 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, Christoph Hellwig
From: Christoph Hellwig <hch@lst.de>
This is an adapted version of the reproduced in OSS BZ #874, which
shows file corruption when using the extent size hint.
Signed-off-by: Geoffrey Wehrman <gwehrman@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
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
diff --git a/229 b/229
new file mode 100644
index 0000000..418a5af
--- /dev/null
+++ b/229
@@ -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 <gwehrman@sgi.com>.
+#
+#-----------------------------------------------------------------------
+# 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
+owner=hch@lst.de
+
+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
diff --git a/229.out b/229.out
new file mode 100644
index 0000000..233920f
--- /dev/null
+++ b/229.out
@@ -0,0 +1,4 @@
+QA output created by 229
+generating 10 files
+comparing files
+got 0 errors
diff --git a/group b/group
index 69ba24d..2c1ac50 100644
--- a/group
+++ b/group
@@ -342,3 +342,4 @@ deprecated
226 auto enospc
227 auto fsr
228 rw auto prealloc quick
+229 auto rw
diff --git a/src/Makefile b/src/Makefile
index 2f95fe2..976133d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/t_holes.c b/src/t_holes.c
new file mode 100644
index 0000000..eba310a
--- /dev/null
+++ b/src/t_holes.c
@@ -0,0 +1,41 @@
+/*
+ * 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
+ */
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ int buf[1024];
+ int fd, i, j;
+
+ fd = open(argv[1], O_RDWR|O_CREAT, 0666);
+ for (i = 1; i < 9100; i++) {
+ for (j = 0; j < 1024; j++)
+ buf[j] = i | i << 5;
+
+ if (write(fd,buf,253*4*sizeof(int))!= 253*4*sizeof(int))
+ printf("Write did not return correct amount\n");
+
+ if ((i % 9) == 0 && i < 9001)
+ lseek(fd, 4096 * 110,SEEK_CUR);
+ }
+
+ close(fd);
+ return 0;
+}
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 1/7] xfstests: test extent size hints
2010-05-19 13:38 ` [PATCH 1/7] xfstests: test extent size hints Jan Kara
@ 2010-05-20 15:01 ` Christoph Hellwig
2010-05-20 17:14 ` Jan Kara
0 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2010-05-20 15:01 UTC (permalink / raw)
To: Jan Kara; +Cc: hch, Christoph Hellwig, xfs
I think you included one patch too many in your series, this was already
applied. Btw, if you have this in a git tree making that available
would ease testing a bit.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/7] xfstests: test extent size hints
2010-05-20 15:01 ` Christoph Hellwig
@ 2010-05-20 17:14 ` Jan Kara
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-20 17:14 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jan Kara, Christoph Hellwig, xfs
On Thu 20-05-10 11:01:42, Christoph Hellwig wrote:
> I think you included one patch too many in your series, this was already
Yes, I've noticed that as well. Sorry for that.
> 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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/7] Fix test whether kernel supports quotas
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
2010-05-19 13:38 ` [PATCH 1/7] xfstests: test extent size hints Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
2010-05-19 18:42 ` Christoph Hellwig
2010-05-19 13:38 ` [PATCH 3/7] Test basic quota enforcement Jan Kara
` (4 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, 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).
Signed-off-by: Jan Kara <jack@suse.cz>
---
common.quota | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/common.quota b/common.quota
index 51bdc71..033390f 100644
--- a/common.quota
+++ b/common.quota
@@ -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"
}
#
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 2/7] Fix test whether kernel supports quotas
2010-05-19 13:38 ` [PATCH 2/7] Fix test whether kernel supports quotas Jan Kara
@ 2010-05-19 18:42 ` Christoph Hellwig
2010-05-20 12:49 ` Jan Kara
0 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2010-05-19 18:42 UTC (permalink / raw)
To: Jan Kara; +Cc: hch, xfs
On Wed, May 19, 2010 at 03:38:04PM +0200, Jan Kara wrote:
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/7] Fix test whether kernel supports quotas
2010-05-19 18:42 ` Christoph Hellwig
@ 2010-05-20 12:49 ` Jan Kara
2010-05-20 15:05 ` Christoph Hellwig
0 siblings, 1 reply; 20+ messages in thread
From: Jan Kara @ 2010-05-20 12:49 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jan Kara, xfs
On Wed 19-05-10 14:42:25, Christoph Hellwig wrote:
> On Wed, May 19, 2010 at 03:38:04PM +0200, Jan Kara wrote:
> > 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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 2/7] Fix test whether kernel supports quotas
2010-05-20 12:49 ` Jan Kara
@ 2010-05-20 15:05 ` Christoph Hellwig
2010-05-20 16:53 ` Jan Kara
0 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2010-05-20 15:05 UTC (permalink / raw)
To: Jan Kara; +Cc: Christoph Hellwig, xfs
On Thu, May 20, 2010 at 02:49:02PM +0200, Jan Kara wrote:
> On Wed 19-05-10 14:42:25, Christoph Hellwig wrote:
> > On Wed, May 19, 2010 at 03:38:04PM +0200, Jan Kara wrote:
> > > 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
That would still fail for GFS2.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/7] Fix test whether kernel supports quotas
2010-05-20 15:05 ` Christoph Hellwig
@ 2010-05-20 16:53 ` Jan Kara
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-20 16:53 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jan Kara, xfs
On Thu 20-05-10 11:05:55, Christoph Hellwig wrote:
> On Thu, May 20, 2010 at 02:49:02PM +0200, Jan Kara wrote:
> > On Wed 19-05-10 14:42:25, Christoph Hellwig wrote:
> > > On Wed, May 19, 2010 at 03:38:04PM +0200, Jan Kara wrote:
> > > > 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
>
> 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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/7] Test basic quota enforcement
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
2010-05-19 13:38 ` [PATCH 1/7] xfstests: test extent size hints Jan Kara
2010-05-19 13:38 ` [PATCH 2/7] Fix test whether kernel supports quotas Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
2010-05-20 15:11 ` Christoph Hellwig
2010-05-19 13:38 ` [PATCH 4/7] Add test of quota accounting using fsx Jan Kara
` (3 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, Jan Kara
Add a test which checks whether basic quota enforcement works.
Signed-off-by: Jan Kara <jack@suse.cz>
---
230 | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
230.out | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
group | 1 +
3 files changed, 277 insertions(+), 0 deletions(-)
create mode 100755 230
create mode 100644 230.out
diff --git a/230 b/230
new file mode 100755
index 0000000..a63e004
--- /dev/null
+++ b/230
@@ -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
+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}
+ 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
diff --git a/230.out b/230.out
new file mode 100644
index 0000000..87fb372
--- /dev/null
+++ b/230.out
@@ -0,0 +1,131 @@
+QA output created by 230
+
+### test user limit enforcement
+
+### create files, setting up ownership (type=u)
+### some buffered IO (type=u)
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa -- 4 4 12 2 2 4
+
+
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa +- 8 4 12 00:00 2 2 4
+
+
+pwrite64: Disk quota exceeded
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa +- 12 4 12 00:00 2 2 4
+
+
+pwrite64: Disk quota exceeded
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa +- 8 4 12 none 2 2 4
+
+
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa ++ 8 4 12 none 3 2 4 00:00
+
+
+touch: cannot touch `/local/test1/file5': Disk quota exceeded
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa ++ 8 4 12 none 4 2 4 00:00
+
+
+touch: cannot touch `/local/test1/file4': Disk quota exceeded
+*** Report for user quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+User used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa ++ 8 4 12 none 3 2 4 none
+
+
+
+### test group limit enforcement
+
+### create files, setting up ownership (type=g)
+### some buffered IO (type=g)
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa -- 4 4 12 2 2 4
+
+
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa +- 8 4 12 00:00 2 2 4
+
+
+pwrite64: Disk quota exceeded
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa +- 12 4 12 00:00 2 2 4
+
+
+pwrite64: Disk quota exceeded
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa +- 8 4 12 none 2 2 4
+
+
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa ++ 8 4 12 none 3 2 4 00:00
+
+
+touch: cannot touch `/local/test1/file5': Disk quota exceeded
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa ++ 8 4 12 none 4 2 4 00:00
+
+
+touch: cannot touch `/local/test1/file4': Disk quota exceeded
+*** Report for group quotas on device [SCR_DEV]
+Block grace time: 00:00; Inode grace time: 00:00
+ Block limits File limits
+Group used soft hard grace used soft hard grace
+----------------------------------------------------------------------
+fsgqa ++ 8 4 12 none 3 2 4 none
+
+
diff --git a/group b/group
index 2c1ac50..441e0e9 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
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 3/7] Test basic quota enforcement
2010-05-19 13:38 ` [PATCH 3/7] Test basic quota enforcement Jan Kara
@ 2010-05-20 15:11 ` Christoph Hellwig
2010-05-20 17:21 ` Jan Kara
0 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2010-05-20 15:11 UTC (permalink / raw)
To: Jan Kara; +Cc: hch, xfs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 274 bytes --]
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,$TT_MNT,TEST_MNT,g"
to make the test portable. This probably applies to the other tests
as well.
[-- Attachment #2: Type: text/plain, Size: 121 bytes --]
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/7] Test basic quota enforcement
2010-05-20 15:11 ` Christoph Hellwig
@ 2010-05-20 17:21 ` Jan Kara
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-20 17:21 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jan Kara, xfs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 869 bytes --]
On Thu 20-05-10 11:11:30, Christoph Hellwig wrote:
> 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,$TT_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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
[-- Attachment #2: Type: text/plain, Size: 121 bytes --]
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/7] Add test of quota accounting using fsx
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
` (2 preceding siblings ...)
2010-05-19 13:38 ` [PATCH 3/7] Test basic quota enforcement Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
2010-05-19 22:28 ` Dave Chinner
2010-05-19 13:38 ` [PATCH 5/7] Add quota test with fsstress Jan Kara
` (2 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, Jan Kara
Run fsx (and also several fsx threads in parallel) and verify that
quota accounting is correct after they finish.
Signed-off-by: Jan Kara <jack@suse.cz>
---
231 | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
231.out | 10 +++++
group | 1 +
3 files changed, 150 insertions(+), 0 deletions(-)
create mode 100755 231
create mode 100644 231.out
diff --git a/231 b/231
new file mode 100755
index 0000000..0e34d33
--- /dev/null
+++ b/231
@@ -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
+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 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
diff --git a/231.out b/231.out
new file mode 100644
index 0000000..2f2d072
--- /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 441e0e9..6b59c69 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
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 4/7] Add test of quota accounting using fsx
2010-05-19 13:38 ` [PATCH 4/7] Add test of quota accounting using fsx Jan Kara
@ 2010-05-19 22:28 ` Dave Chinner
2010-05-20 12:52 ` Jan Kara
0 siblings, 1 reply; 20+ messages in thread
From: Dave Chinner @ 2010-05-19 22:28 UTC (permalink / raw)
To: Jan Kara; +Cc: hch, xfs
On Wed, May 19, 2010 at 03:38:06PM +0200, Jan Kara wrote:
> Run fsx (and also several fsx threads in parallel) and verify that
> quota accounting is correct after they finish.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> 231 | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 231.out | 10 +++++
> group | 1 +
> 3 files changed, 150 insertions(+), 0 deletions(-)
> create mode 100755 231
> create mode 100644 231.out
>
> diff --git a/231 b/231
> new file mode 100755
> index 0000000..0e34d33
> --- /dev/null
> +++ b/231
> @@ -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
> +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 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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/7] Add test of quota accounting using fsx
2010-05-19 22:28 ` Dave Chinner
@ 2010-05-20 12:52 ` Jan Kara
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-20 12:52 UTC (permalink / raw)
To: Dave Chinner; +Cc: hch, Jan Kara, xfs
On Thu 20-05-10 08:28:13, Dave Chinner wrote:
> On Wed, May 19, 2010 at 03:38:06PM +0200, Jan Kara wrote:
> > Run fsx (and also several fsx threads in parallel) and verify that
> > quota accounting is correct after they finish.
> >
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > 231 | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 231.out | 10 +++++
> > group | 1 +
> > 3 files changed, 150 insertions(+), 0 deletions(-)
> > create mode 100755 231
> > create mode 100644 231.out
> >
> > diff --git a/231 b/231
> > new file mode 100755
> > index 0000000..0e34d33
> > --- /dev/null
> > +++ b/231
> > @@ -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
> > +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 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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 5/7] Add quota test with fsstress
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
` (3 preceding siblings ...)
2010-05-19 13:38 ` [PATCH 4/7] Add test of quota accounting using fsx Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
2010-05-20 13:16 ` Dave Chinner
2010-05-19 13:38 ` [PATCH 6/7] Add quota accounting test when fsstress is run and quota limits are set low Jan Kara
2010-05-19 13:38 ` [PATCH 7/7] Add test of quota limit and info setting Jan Kara
6 siblings, 1 reply; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, Jan Kara
Run fsstress and verify that quota accounting is correct after it finishes.
Signed-off-by: Jan Kara <jack@suse.cz>
---
232 | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
232.out | 6 +++
group | 1 +
3 files changed, 125 insertions(+), 0 deletions(-)
create mode 100755 232
create mode 100644 232.out
diff --git a/232 b/232
new file mode 100755
index 0000000..ef8ce8a
--- /dev/null
+++ b/232
@@ -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
+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=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
diff --git a/232.out b/232.out
new file mode 100644
index 0000000..744192e
--- /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 6b59c69..c8cd774 100644
--- a/group
+++ b/group
@@ -345,3 +345,4 @@ deprecated
229 auto rw
230 auto quota quick
231 auto quota
+232 auto quota
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 5/7] Add quota test with fsstress
2010-05-19 13:38 ` [PATCH 5/7] Add quota test with fsstress Jan Kara
@ 2010-05-20 13:16 ` Dave Chinner
2010-05-20 13:22 ` Jan Kara
0 siblings, 1 reply; 20+ messages in thread
From: Dave Chinner @ 2010-05-20 13:16 UTC (permalink / raw)
To: Jan Kara; +Cc: hch, xfs
On Wed, May 19, 2010 at 03:38:07PM +0200, Jan Kara wrote:
> Run fsstress and verify that quota accounting is correct after it finishes.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> 232 | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 232.out | 6 +++
> group | 1 +
> 3 files changed, 125 insertions(+), 0 deletions(-)
> create mode 100755 232
> create mode 100644 232.out
>
> diff --git a/232 b/232
> new file mode 100755
> index 0000000..ef8ce8a
> --- /dev/null
> +++ b/232
> @@ -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
....
> +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.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/7] Add quota test with fsstress
2010-05-20 13:16 ` Dave Chinner
@ 2010-05-20 13:22 ` Jan Kara
0 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-20 13:22 UTC (permalink / raw)
To: Dave Chinner; +Cc: hch, Jan Kara, xfs
On Thu 20-05-10 23:16:42, Dave Chinner wrote:
> On Wed, May 19, 2010 at 03:38:07PM +0200, Jan Kara wrote:
> > Run fsstress and verify that quota accounting is correct after it finishes.
> >
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > 232 | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 232.out | 6 +++
> > group | 1 +
> > 3 files changed, 125 insertions(+), 0 deletions(-)
> > create mode 100755 232
> > create mode 100644 232.out
> >
> > diff --git a/232 b/232
> > new file mode 100755
> > index 0000000..ef8ce8a
> > --- /dev/null
> > +++ b/232
> > @@ -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
> ....
> > +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
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 6/7] Add quota accounting test when fsstress is run and quota limits are set low
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
` (4 preceding siblings ...)
2010-05-19 13:38 ` [PATCH 5/7] Add quota test with fsstress Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
2010-05-19 13:38 ` [PATCH 7/7] Add test of quota limit and info setting Jan Kara
6 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, Jan Kara
Test various error recovery paths whether they properly handle EDQUOT failures.
Signed-off-by: Jan Kara <jack@suse.cz>
---
233 | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
233.out | 6 +++
group | 1 +
3 files changed, 131 insertions(+), 0 deletions(-)
create mode 100755 233
create mode 100644 233.out
diff --git a/233 b/233
new file mode 100755
index 0000000..1185a6d
--- /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" | 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
diff --git a/233.out b/233.out
new file mode 100644
index 0000000..208910d
--- /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 c8cd774..cc9bdb2 100644
--- a/group
+++ b/group
@@ -346,3 +346,4 @@ deprecated
230 auto quota quick
231 auto quota
232 auto quota
+233 auto quota
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 7/7] Add test of quota limit and info setting
2010-05-19 13:38 [PATCH 0/7 V2] Quota tests for XFSQA Jan Kara
` (5 preceding siblings ...)
2010-05-19 13:38 ` [PATCH 6/7] Add quota accounting test when fsstress is run and quota limits are set low Jan Kara
@ 2010-05-19 13:38 ` Jan Kara
6 siblings, 0 replies; 20+ messages in thread
From: Jan Kara @ 2010-05-19 13:38 UTC (permalink / raw)
To: xfs; +Cc: hch, Jan Kara
Add test stressing addition and removal of quota structures and setting
of quota grace time.
Signed-off-by: Jan Kara <jack@suse.cz>
---
234 | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
234.out | 4 ++
group | 1 +
3 files changed, 111 insertions(+), 0 deletions(-)
create mode 100755 234
create mode 100644 234.out
diff --git a/234 b/234
new file mode 100755
index 0000000..84604eb
--- /dev/null
+++ b/234
@@ -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
+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
+
+ 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
diff --git a/234.out b/234.out
new file mode 100644
index 0000000..78d1587
--- /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 cc9bdb2..3a95e48 100644
--- a/group
+++ b/group
@@ -347,3 +347,4 @@ deprecated
231 auto quota
232 auto quota
233 auto quota
+234 auto quota
--
1.6.4.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 20+ messages in thread