[PATCH 3/4] xfstests: Add a simple test to check separate pquota/gquota

Chandra Seetharaman
2012-02-21T16:58:58Z

>From d54abe9e75f7b3750982275f04eecd9cc6b86335 Mon Sep 17 00:00:00 2001
From: Chandra Seetharaman <sekharan@us.ibm.com>
Date: Wed, 8 Feb 2012 10:06:18 -0600
Subject: [PATCH 3/3] Add a simple test to check simultaneous use of pquota and gquota.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
276 | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
276.out | 69 +++++++++++++++++++++++++++++++++++++
2 files changed, 186 insertions(+), 0 deletions(-)
create mode 100755 276
create mode 100644 276.out

diff --git a/276 b/276
new file mode 100755
index 0000000..3ce95ab
--- /dev/null
+++ b/276
@@ -0,0 +1,117 @@
+#! /bin/bash
+# FS QA Test No. 276
+#
+# Simple quota accounting test for simulaneously using pquota and gquota
+# A cut-down version of test # 180.
+#
+#-----------------------------------------------------------------------
+# 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=sekharan@us.ibm.com
+
+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
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+_require_xfs_quota
+_require_seppquota
+
+test_files()
+{
+ echo; echo "### create files, setting up ownership (type=$type)"
+ rm -f $SCRATCH_MNT/{buffer,direct,mmap}
+ $XFS_IO_PROG -fc "chproj $prid" $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
+ $XFS_IO_PROG -c lsproj $file
+ done
+}
+
+test_accounting()
+{
+ echo "### some controlled buffered, direct and mmapd IO (type=$type)"
+ echo "--- initiating parallel IO..." >>$seq.full
+ $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -c 'fsync' \
+ $SCRATCH_MNT/buffer >>$seq.full 2>&1 &
+ $XFS_IO_PROG -c 'pwrite -b 1m 0 16m' -d \
+ $SCRATCH_MNT/direct >>$seq.full 2>&1 &
+ $XFS_IO_PROG -c 't 16m' -c 'mm -rw 0 16m' -c 'mw 0 16m' -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
+ xfs_quota -c "quota -hnb -$type $id" $QARGS | _filter_scratch | _filter_spaces
+ xfs_quota -c "quota -hni -$type $id" $QARGS | _filter_scratch | _filter_spaces
+ xfs_quota -c "quota -hnr -$type $id" $QARGS | _filter_scratch | _filter_spaces
+}
+
+export MOUNT_OPTIONS="-opquota"
+_qmount
+_require_prjquota $SCRATCH_DEV
+_require_prjquota $SCRATCH_DEV
+
+# real QA test starts here
+rm -f $tmp.projects $seq.full
+umount $SCRATCH_DEV 2>/dev/null
+export MKFS_OPTIONS="$MKFS_OPTIONS -d seppquota=1"
+_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs
+cat $tmp.mkfs >>$seq.full
+_scratch_mount
+
+uid=1
+gid=2
+prid=3
+export QARGS="-x -D /dev/null -P /dev/null $SCRATCH_MNT"
+umount $SCRATCH_DEV
+export MOUNT_OPTIONS="-ogquota,pquota"
+_qmount
+
+echo; echo "### test group accounting"
+type=g
+id=$gid
+test_files
+test_accounting
+
+#echo; echo "### test project accounting"
+type=p
+id=$prid
+test_files
+test_accounting
+umount $SCRATCH_DEV 2>/dev/null
+
+status=0
+exit
diff --git a/276.out b/276.out
new file mode 100644
index 0000000..4d2390b
--- /dev/null
+++ b/276.out
@@ -0,0 +1,69 @@
+QA output created by 276
+meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
+data = bsize=XXX blocks=XXX, imaxpct=PCT
+ = sunit=XXX swidth=XXX, unwritten=X
+naming =VERN bsize=XXX
+log =LDEV bsize=XXX blocks=XXX
+realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
+
+### test group accounting
+
+### create files, setting up ownership (type=g)
+ File: "SCRATCH_MNT/buffer"
+ Size: 0 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+projid = 3
+ File: "SCRATCH_MNT/direct"
+ Size: 0 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+projid = 3
+ File: "SCRATCH_MNT/mmap"
+ Size: 0 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+projid = 3
+### some controlled buffered, direct and mmapd IO (type=g)
+ File: "SCRATCH_MNT/buffer"
+ Size: 16777216 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+ File: "SCRATCH_MNT/direct"
+ Size: 16777216 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+ File: "SCRATCH_MNT/mmap"
+ Size: 16777216 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+Disk quotas for Group #2 (2)
+Filesystem Blocks Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 48M 0 0 00 [------] SCRATCH_MNT
+Disk quotas for Group #2 (2)
+Filesystem Files Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 3 0 0 00 [------] SCRATCH_MNT
+
+### create files, setting up ownership (type=p)
+ File: "SCRATCH_MNT/buffer"
+ Size: 0 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+projid = 3
+ File: "SCRATCH_MNT/direct"
+ Size: 0 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+projid = 3
+ File: "SCRATCH_MNT/mmap"
+ Size: 0 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+projid = 3
+### some controlled buffered, direct and mmapd IO (type=p)
+ File: "SCRATCH_MNT/buffer"
+ Size: 16777216 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+ File: "SCRATCH_MNT/direct"
+ Size: 16777216 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+ File: "SCRATCH_MNT/mmap"
+ Size: 16777216 Filetype: Regular File
+ Mode: (0600/-rw-------) Uid: (1) Gid: (2)
+Disk quotas for Project #3 (3)
+Filesystem Blocks Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 48M 0 0 00 [------] SCRATCH_MNT
+Disk quotas for Project #3 (3)
+Filesystem Files Quota Limit Warn/Time Mounted on
+SCRATCH_DEV 3 0 0 00 [------] SCRATCH_MNT