All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] move xfs non-project quota tests to generic
@ 2016-09-20 22:14 Eric Sandeen
  2016-09-20 22:15 ` [PATCH 1/3] xfs/260: fix output to match actions Eric Sandeen
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Eric Sandeen @ 2016-09-20 22:14 UTC (permalink / raw)
  To: fstests

Now that bleeding edge xfs_quota can support basic operations
on non-xfs filesystems, move some xfs-specific quota tests into
generic/

Project related tests will come later after a bit more cleanup.

Several xfs quota tests can't be generic, as they depend on
various xfs-specific bits like xfs_db or bulkstat.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] xfs/260: fix output to match actions
  2016-09-20 22:14 [PATCH 0/3] move xfs non-project quota tests to generic Eric Sandeen
@ 2016-09-20 22:15 ` Eric Sandeen
  2016-09-22 14:07   ` Bill O'Donnell
  2016-09-20 22:21 ` [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems Eric Sandeen
  2016-09-20 22:24 ` [PATCH 3/3] move now-generic quota tests to generic Eric Sandeen
  2 siblings, 1 reply; 15+ messages in thread
From: Eric Sandeen @ 2016-09-20 22:15 UTC (permalink / raw)
  To: Eric Sandeen, fstests

The test creates 30 inodes, but says it created 300.
Just fix that up so the repquota output matches the
comments in the output file.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/tests/xfs/260 b/tests/xfs/260
index 70486ac..9c6162b 100755
--- a/tests/xfs/260
+++ b/tests/xfs/260
@@ -93,7 +93,7 @@ do_test()
 	done
 	sync
 
-	echo "$qname inode quota after create 300 inodes"
+	echo "$qname inode quota after creating 30 inodes"
 	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
diff --git a/tests/xfs/260.out b/tests/xfs/260.out
index 4965eeb..0b198bf 100644
--- a/tests/xfs/260.out
+++ b/tests/xfs/260.out
@@ -10,7 +10,7 @@ user blocks quota after write 30M data
 root 0 20480 20480 00 [--------]
 fsgqa 30720 40960 40960 00 [--------]
 
-user inode quota after create 300 inodes
+user inode quota after creating 30 inodes
 root 3 20 20 00 [--------]
 fsgqa 30 40 40 00 [--------]
 
@@ -25,7 +25,7 @@ group blocks quota after write 30M data
 root 0 20480 20480 00 [--------]
 fsgqa 30720 40960 40960 00 [--------]
 
-group inode quota after create 300 inodes
+group inode quota after creating 30 inodes
 root 3 20 20 00 [--------]
 fsgqa 30 40 40 00 [--------]
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems
  2016-09-20 22:14 [PATCH 0/3] move xfs non-project quota tests to generic Eric Sandeen
  2016-09-20 22:15 ` [PATCH 1/3] xfs/260: fix output to match actions Eric Sandeen
@ 2016-09-20 22:21 ` Eric Sandeen
  2016-09-21  9:37   ` Eryu Guan
                     ` (2 more replies)
  2016-09-20 22:24 ` [PATCH 3/3] move now-generic quota tests to generic Eric Sandeen
  2 siblings, 3 replies; 15+ messages in thread
From: Eric Sandeen @ 2016-09-20 22:21 UTC (permalink / raw)
  To: Eric Sandeen, fstests

Fix several xfs quota tests to work on non-xfs filesystems.

New _require function to be sure that the xfs_quota tool can operate
on foreign filesystems; if it can, and if it needs to, it adds "-f"
to the XFS_QUOTA_PROG variable.

Modify _qmount to do quotacheck/quotaon to mount and /enable/
quota.  On xfs this isn't needed and/or fails; it's ignored.

All quota-related options used as arguments to _qmount are changed
from i.e. uquota to i.e. usrquota; the latter is standard across
almost all linux filesytems, including xfs.

xfs/260 filters out the root/default quota line, because ext4
consumes a different amount of space than xfs, and it's not what
we're testing for, so just ignore it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/common/quota b/common/quota
index d91062a..2ec56a5 100644
--- a/common/quota
+++ b/common/quota
@@ -78,6 +78,19 @@ _require_xfs_quota()
 }
 
 #
+# checks that xfs_quota can operate on foreign (non-xfs) filesystems
+# Skips check on xfs filesystems, old xfs_quota is fine there.
+# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
+#
+_require_xfs_quota_foreign()
+{
+    if [ "$FSTYP" != "xfs" ]; then
+	$XFS_QUOTA_PROG -f -V &>/dev/null || \
+		_notrun "xfs_quota binary does not support foreign filesystems"
+	XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
+    fi
+}
+#
 # checks that the XFS project quota support in the kernel is enabled.
 #
 _require_prjquota()
@@ -169,6 +182,10 @@ _qmount()
 {
     _scratch_unmount >/dev/null 2>&1
     _scratch_mount || _fail "qmount failed"
+    # xfs doesn't need these setups and quotacheck even fails on xfs, so just
+    # redirect the output to $seqres.full for debug purpose and ignore the results
+    quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
+    quotaon -u -g $SCRATCH_MNT >>$seqres.full 2>&1
     chmod ugo+rwx $SCRATCH_MNT
 }
 
diff --git a/tests/xfs/054 b/tests/xfs/054
index ea0f9f8..b4e5dd1 100755
--- a/tests/xfs/054
+++ b/tests/xfs/054
@@ -44,14 +44,15 @@ _cleanup()
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux IRIX
 
 cp /dev/null $seqres.full
 chmod ugo+rwx $seqres.full
 
 _require_scratch
-_require_xfs_quota
+_require_quota
+_require_xfs_quota_foreign
 
 _filter_stat()
 {
@@ -67,7 +68,7 @@ _filter_stat()
 
 _exercise()
 {
-	_scratch_mkfs_xfs >/dev/null 2>&1
+	_scratch_mkfs >/dev/null 2>&1
 	_qmount
 
 	umask 022
@@ -99,9 +100,9 @@ _exercise()
 	_scratch_unmount 2>/dev/null
 }
 
-_scratch_mkfs_xfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
+_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
 
-_qmount_option "uquota,gquota"
+_qmount_option "usrquota,grpquota"
 _qmount
 if src/feature -G $SCRATCH_DEV ; then
 	:
@@ -114,16 +115,15 @@ _qmount_option "rw" # no quota options
 echo "*** Default mount options"
 _exercise
 
-_qmount_option "uquota"
+_qmount_option "usrquota"
 echo "*** User quota mount option"
 _exercise
 
-export MOUNT_OPTIONS="-o gquota"
-_qmount_option "gquota"
+_qmount_option "grpquota"
 echo "*** Group quota mount option"
 _exercise
 
-_qmount_option "uquota,gquota"
+_qmount_option "usrquota,grpquota"
 echo "*** User and Group quota mount options"
 _exercise
 
diff --git a/tests/xfs/118 b/tests/xfs/118
index 8414594..da18a32 100755
--- a/tests/xfs/118
+++ b/tests/xfs/118
@@ -47,11 +47,12 @@ _cleanup()
 # real QA test starts here
 
 # Modify as appropriate.
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
-_require_xfs_quota
+_require_quota
+_require_xfs_quota_foreign
 
 _chowning_file()
 {
@@ -72,10 +73,10 @@ _chowning_file()
 }
 
 echo "mkfs on scratch"
-_scratch_mkfs_xfs >$seqres.full
+_scratch_mkfs >$seqres.full
 
 echo "mount with quotas"
-export MOUNT_OPTIONS="-o uquota"
+export MOUNT_OPTIONS="-o usrquota"
 _scratch_mount
 
 echo "creating quota file with holes"
diff --git a/tests/xfs/138 b/tests/xfs/138
index c6a6f50..6b6a12f 100755
--- a/tests/xfs/138
+++ b/tests/xfs/138
@@ -47,17 +47,18 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_quota
+_require_xfs_quota_foreign
 
 # need user and group named 123456-fsgqa
 _require_user 123456-fsgqa
 _require_group 123456-fsgqa
 
-_scratch_mkfs_xfs >/dev/null 2>&1
-_qmount_option "uquota,gquota"
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "usrquota,grpquota"
 _qmount
 
 # user test
diff --git a/tests/xfs/260 b/tests/xfs/260
index 9c6162b..a2bc3ce 100755
--- a/tests/xfs/260
+++ b/tests/xfs/260
@@ -52,10 +52,11 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_quota
+_require_xfs_quota_foreign
 _require_user
 _require_group
 
@@ -78,12 +79,12 @@ do_test()
 	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
 	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
 	echo "$qname blocks and inode limit"
-	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
 
 	## blocks default quota test ##
 	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
 	echo "$qname blocks quota after write 30M data"
-	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
 
@@ -94,22 +95,22 @@ do_test()
 	sync
 
 	echo "$qname inode quota after creating 30 inodes"
-	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
 }
 
 ### user default quota test ###
-_scratch_mkfs_xfs >/dev/null 2>&1
-_qmount_option "uquota,gquota"
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "usrquota,grpquota"
 _qmount
 
 do_test user
 
 ### group default quota test ###
 _scratch_unmount
-_scratch_mkfs_xfs >/dev/null 2>&1
-_qmount_option "gquota,uquota"
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "grpquota,usrquota"
 _qmount
 
 do_test group
diff --git a/tests/xfs/260.out b/tests/xfs/260.out
index 0b198bf..5eb1070 100644
--- a/tests/xfs/260.out
+++ b/tests/xfs/260.out
@@ -1,31 +1,25 @@
 QA output created by 260
 === user quota test ===
 user blocks and inode limit
-root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
 fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
 
 wrote 31457280/31457280 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 user blocks quota after write 30M data
-root 0 20480 20480 00 [--------]
 fsgqa 30720 40960 40960 00 [--------]
 
 user inode quota after creating 30 inodes
-root 3 20 20 00 [--------]
 fsgqa 30 40 40 00 [--------]
 
 === group quota test ===
 group blocks and inode limit
-root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
 fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
 
 wrote 31457280/31457280 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 group blocks quota after write 30M data
-root 0 20480 20480 00 [--------]
 fsgqa 30720 40960 40960 00 [--------]
 
 group inode quota after creating 30 inodes
-root 3 20 20 00 [--------]
 fsgqa 30 40 40 00 [--------]
 



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/3] move now-generic quota tests to generic
  2016-09-20 22:14 [PATCH 0/3] move xfs non-project quota tests to generic Eric Sandeen
  2016-09-20 22:15 ` [PATCH 1/3] xfs/260: fix output to match actions Eric Sandeen
  2016-09-20 22:21 ` [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems Eric Sandeen
@ 2016-09-20 22:24 ` Eric Sandeen
  2016-09-20 23:40   ` Dave Chinner
  2 siblings, 1 reply; 15+ messages in thread
From: Eric Sandeen @ 2016-09-20 22:24 UTC (permalink / raw)
  To: Eric Sandeen, fstests

Now that these tests have been made generic, move them into
the generic/ dir and update group files.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/tests/generic/group b/tests/generic/group
index a602b01..f5ebbb1 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -381,3 +381,8 @@
 376 auto quick metadata
 377 attr auto quick metadata
 378 auto quick metadata
+380 quota auto quick
+381 quota auto quick
+382 auto quick quota
+383 auto quick quota
+
diff --git a/tests/xfs/054 b/tests/xfs/054
deleted file mode 100755
index b4e5dd1..0000000
--- a/tests/xfs/054
+++ /dev/null
@@ -1,132 +0,0 @@
-#! /bin/bash
-# FS QA Test No. 054
-#
-# Check behavior of chown with both user and group quota enabled,
-# and changing both user and group together via chown(2).
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2000-2002 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
-#
-#-----------------------------------------------------------------------
-#
-
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-. ./common/quota
-
-_cleanup()
-{
-	_scratch_unmount 2>/dev/null
-	rm -f $tmp.*
-}
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
-# real QA test starts here
-_supported_fs generic
-_supported_os Linux IRIX
-
-cp /dev/null $seqres.full
-chmod ugo+rwx $seqres.full
-
-_require_scratch
-_require_quota
-_require_xfs_quota_foreign
-
-_filter_stat()
-{
-    sed "
-        /^Access:/d;
-        /^Modify:/d;
-        /^Change:/d;
-        s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
-        s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
-        s,$SCRATCH_MNT,<MOUNT>,;
-    " | tr -s ' '
-}
-
-_exercise()
-{
-	_scratch_mkfs >/dev/null 2>&1
-	_qmount
-
-	umask 022
-	touch $SCRATCH_MNT/testfile
-	if src/feature -c $SCRATCH_MNT/testfile; then
-		:
-	else
-		_notrun "Installed fileutils doesn't support 32 bit uids/gids"
-	fi
-
-	chown 12345 $SCRATCH_MNT/testfile
-	chgrp 54321 $SCRATCH_MNT/testfile
-	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
-
-	chown 34567 $SCRATCH_MNT/testfile
-	chgrp 76543 $SCRATCH_MNT/testfile
-	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
-
-	chown 56789 $SCRATCH_MNT/testfile
-	chgrp 98765 $SCRATCH_MNT/testfile
-	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
-
-	# finally give back to original owners
-	chown 12345 $SCRATCH_MNT/testfile
-	chgrp 54321 $SCRATCH_MNT/testfile
-	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
-
-	echo
-	_scratch_unmount 2>/dev/null
-}
-
-_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
-
-_qmount_option "usrquota,grpquota"
-_qmount
-if src/feature -G $SCRATCH_DEV ; then
-	:
-else
-	_notrun "No quota support at mount time"
-fi
-_scratch_unmount 2>/dev/null
-
-_qmount_option "rw" # no quota options
-echo "*** Default mount options"
-_exercise
-
-_qmount_option "usrquota"
-echo "*** User quota mount option"
-_exercise
-
-_qmount_option "grpquota"
-echo "*** Group quota mount option"
-_exercise
-
-_qmount_option "usrquota,grpquota"
-echo "*** User and Group quota mount options"
-_exercise
-
-# success, all done
-status=0
-exit
diff --git a/tests/xfs/054.out b/tests/xfs/054.out
deleted file mode 100644
index 40c010c..0000000
--- a/tests/xfs/054.out
+++ /dev/null
@@ -1,73 +0,0 @@
-QA output created by 054
-*** Default mount options
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
-
-*** User quota mount option
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
-
-*** Group quota mount option
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
-
-*** User and Group quota mount options
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
-Device: <DEVICE> Inode: <INODE> Links: 1 
- File: "<MOUNT>/testfile"
- Size: 0 Filetype: Regular File
- Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
-Device: <DEVICE> Inode: <INODE> Links: 1 
-
diff --git a/tests/xfs/118 b/tests/xfs/118
deleted file mode 100755
index da18a32..0000000
--- a/tests/xfs/118
+++ /dev/null
@@ -1,95 +0,0 @@
-#! /bin/bash
-# FS QA Test No. 118
-#
-# To test out pv#940675 crash in xfs_trans_brelse + quotas
-# Without the fix, this will create an ASSERT failure in debug kernels
-# and crash a non-debug kernel.
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2000-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
-#
-#-----------------------------------------------------------------------
-#
-
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
-_cleanup()
-{
-    cd /
-    rm -f $tmp.*
-}
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-. ./common/quota
-
-# real QA test starts here
-
-# Modify as appropriate.
-_supported_fs generic
-_supported_os IRIX Linux
-
-_require_scratch
-_require_quota
-_require_xfs_quota_foreign
-
-_chowning_file()
-{
-	file=file.chown
-	let start=$1
-	let limit=$2
-	let delta=$3
-
-	cd $SCRATCH_MNT
-	let count=$start
-	while (( count < limit )); do
-	    touch $file
-	    chown $count.$count $file
-	    echo -n "."
-	    let count=count+delta
-	done
-	echo ""
-}
-
-echo "mkfs on scratch"
-_scratch_mkfs >$seqres.full
-
-echo "mount with quotas"
-export MOUNT_OPTIONS="-o usrquota"
-_scratch_mount
-
-echo "creating quota file with holes"
-_chowning_file 1000 2000 100
-
-echo "now fill in the holes"
-_chowning_file 1000 2000 1
-
-echo "look at the final file ownership for fun"
-ls -l $SCRATCH_MNT/* \
-| $AWK_PROG 'NF > 2 {print $3, $4, $NF}' \
-| sed "s#$SCRATCH_MNT#SCRATCH_MNT#g"
-
-# success, all done
-status=0
-exit
diff --git a/tests/xfs/118.out b/tests/xfs/118.out
deleted file mode 100644
index 5cdb694..0000000
--- a/tests/xfs/118.out
+++ /dev/null
@@ -1,9 +0,0 @@
-QA output created by 118
-mkfs on scratch
-mount with quotas
-creating quota file with holes
-..........
-now fill in the holes
-........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-look at the final file ownership for fun
-1999 1999 SCRATCH_MNT/file.chown
diff --git a/tests/xfs/138 b/tests/xfs/138
deleted file mode 100755
index 6b6a12f..0000000
--- a/tests/xfs/138
+++ /dev/null
@@ -1,82 +0,0 @@
-#! /bin/bash
-# FS QA Test 138
-#
-# Test xfs_quota when user or names beginning with digits.
-# For example, create a 'limit' for a user or group named
-# '12345678-abcd', then query this user and group.
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2015 Red Hat 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
-#-----------------------------------------------------------------------
-#
-
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
-_cleanup()
-{
-	cd /
-	rm -f $tmp.*
-}
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-. ./common/quota
-
-# remove previous $seqres.full before test
-rm -f $seqres.full
-
-# real QA test starts here
-_supported_fs generic
-_supported_os Linux
-_require_scratch
-_require_quota
-_require_xfs_quota_foreign
-
-# need user and group named 123456-fsgqa
-_require_user 123456-fsgqa
-_require_group 123456-fsgqa
-
-_scratch_mkfs >/dev/null 2>&1
-_qmount_option "usrquota,grpquota"
-_qmount
-
-# user test
-echo "== user test =="
-$XFS_QUOTA_PROG -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
-echo "=== quota command output ==="
-$XFS_QUOTA_PROG -c "quota -u -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
-echo "=== report command output ==="
-$XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
-
-# group test
-echo "== group test =="
-$XFS_QUOTA_PROG -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
-echo "=== quota command output ==="
-$XFS_QUOTA_PROG -c "quota -g -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
-echo "=== report command output ==="
-$XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
-
-# success, all done
-status=0
-exit
diff --git a/tests/xfs/138.out b/tests/xfs/138.out
deleted file mode 100644
index 71929c4..0000000
--- a/tests/xfs/138.out
+++ /dev/null
@@ -1,13 +0,0 @@
-QA output created by 138
-== user test ==
-=== quota command output ===
-SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
-=== report command output ===
-123456-fsgqa 0 102400 204800 00 [--------]
-
-== group test ==
-=== quota command output ===
-SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
-=== report command output ===
-123456-fsgqa 0 102400 204800 00 [--------]
-
diff --git a/tests/xfs/260 b/tests/xfs/260
deleted file mode 100755
index a2bc3ce..0000000
--- a/tests/xfs/260
+++ /dev/null
@@ -1,120 +0,0 @@
-#! /bin/bash
-# FS QA Test 260
-#
-# When default quota is set, all different quota types inherits the
-# same default value, include group quota. So if a user quota limit
-# larger than the default user quota value, it will still be limited
-# by the group default quota value.
-#
-# There's a patch from Upstream can fix this bug:
-#
-#    [PATCH] xfs: Split default quota limits by quota type V4
-#
-#-----------------------------------------------------------------------
-# Copyright (c) 2016 Red Hat, 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
-#-----------------------------------------------------------------------
-#
-
-seq=`basename $0`
-seqres=$RESULT_DIR/$seq
-echo "QA output created by $seq"
-
-here=`pwd`
-tmp=/tmp/$$
-status=1	# failure is the default!
-trap "_cleanup; exit \$status" 0 1 2 3 15
-
-_cleanup()
-{
-	cd /
-	rm -f $tmp.*
-}
-
-# get standard environment, filters and checks
-. ./common/rc
-. ./common/filter
-. ./common/quota
-
-# remove previous $seqres.full before test
-rm -f $seqres.full
-
-# real QA test starts here
-_supported_fs generic
-_supported_os Linux
-_require_scratch
-_require_quota
-_require_xfs_quota_foreign
-_require_user
-_require_group
-
-do_test()
-{
-	local qname=$1
-	local type
-
-	if [ "$qname" = "user" ];then
-		type="-u"
-		echo "=== user quota test ==="
-	elif [ "$qname" = "group" ];then
-		type="-g"
-		echo "=== group quota test ==="
-	else
-		echo "wrong quota type name - $qname"
-		return 1
-	fi
-
-	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
-	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
-	echo "$qname blocks and inode limit"
-	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
-
-	## blocks default quota test ##
-	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
-	echo "$qname blocks quota after write 30M data"
-	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
-
-	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
-
-	## inode default quota test ##
-	for ((i=0; i<30; i++));do
-		_user_do "echo -n > ${SCRATCH_MNT}/file${i}"
-	done
-	sync
-
-	echo "$qname inode quota after creating 30 inodes"
-	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
-
-	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
-}
-
-### user default quota test ###
-_scratch_mkfs >/dev/null 2>&1
-_qmount_option "usrquota,grpquota"
-_qmount
-
-do_test user
-
-### group default quota test ###
-_scratch_unmount
-_scratch_mkfs >/dev/null 2>&1
-_qmount_option "grpquota,usrquota"
-_qmount
-
-do_test group
-
-# success, all done
-status=0
-exit
diff --git a/tests/xfs/260.out b/tests/xfs/260.out
deleted file mode 100644
index 5eb1070..0000000
--- a/tests/xfs/260.out
+++ /dev/null
@@ -1,25 +0,0 @@
-QA output created by 260
-=== user quota test ===
-user blocks and inode limit
-fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
-
-wrote 31457280/31457280 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-user blocks quota after write 30M data
-fsgqa 30720 40960 40960 00 [--------]
-
-user inode quota after creating 30 inodes
-fsgqa 30 40 40 00 [--------]
-
-=== group quota test ===
-group blocks and inode limit
-fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
-
-wrote 31457280/31457280 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-group blocks quota after write 30M data
-fsgqa 30720 40960 40960 00 [--------]
-
-group inode quota after creating 30 inodes
-fsgqa 30 40 40 00 [--------]
-
diff --git a/tests/xfs/380 b/tests/xfs/380
new file mode 100755
index 0000000..b4e5dd1
--- /dev/null
+++ b/tests/xfs/380
@@ -0,0 +1,132 @@
+#! /bin/bash
+# FS QA Test No. 054
+#
+# Check behavior of chown with both user and group quota enabled,
+# and changing both user and group together via chown(2).
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2000-2002 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
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/quota
+
+_cleanup()
+{
+	_scratch_unmount 2>/dev/null
+	rm -f $tmp.*
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux IRIX
+
+cp /dev/null $seqres.full
+chmod ugo+rwx $seqres.full
+
+_require_scratch
+_require_quota
+_require_xfs_quota_foreign
+
+_filter_stat()
+{
+    sed "
+        /^Access:/d;
+        /^Modify:/d;
+        /^Change:/d;
+        s/Device: *[0-9][0-9]*,[0-9][0-9]*/Device: <DEVICE>/;
+        s/Inode: *[0-9][0-9]*/Inode: <INODE>/;
+        s,$SCRATCH_MNT,<MOUNT>,;
+    " | tr -s ' '
+}
+
+_exercise()
+{
+	_scratch_mkfs >/dev/null 2>&1
+	_qmount
+
+	umask 022
+	touch $SCRATCH_MNT/testfile
+	if src/feature -c $SCRATCH_MNT/testfile; then
+		:
+	else
+		_notrun "Installed fileutils doesn't support 32 bit uids/gids"
+	fi
+
+	chown 12345 $SCRATCH_MNT/testfile
+	chgrp 54321 $SCRATCH_MNT/testfile
+	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
+
+	chown 34567 $SCRATCH_MNT/testfile
+	chgrp 76543 $SCRATCH_MNT/testfile
+	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
+
+	chown 56789 $SCRATCH_MNT/testfile
+	chgrp 98765 $SCRATCH_MNT/testfile
+	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
+
+	# finally give back to original owners
+	chown 12345 $SCRATCH_MNT/testfile
+	chgrp 54321 $SCRATCH_MNT/testfile
+	src/lstat64 $SCRATCH_MNT/testfile | _filter_stat
+
+	echo
+	_scratch_unmount 2>/dev/null
+}
+
+_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
+
+_qmount_option "usrquota,grpquota"
+_qmount
+if src/feature -G $SCRATCH_DEV ; then
+	:
+else
+	_notrun "No quota support at mount time"
+fi
+_scratch_unmount 2>/dev/null
+
+_qmount_option "rw" # no quota options
+echo "*** Default mount options"
+_exercise
+
+_qmount_option "usrquota"
+echo "*** User quota mount option"
+_exercise
+
+_qmount_option "grpquota"
+echo "*** Group quota mount option"
+_exercise
+
+_qmount_option "usrquota,grpquota"
+echo "*** User and Group quota mount options"
+_exercise
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/380.out b/tests/xfs/380.out
new file mode 100644
index 0000000..40c010c
--- /dev/null
+++ b/tests/xfs/380.out
@@ -0,0 +1,73 @@
+QA output created by 054
+*** Default mount options
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
+*** User quota mount option
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
+*** Group quota mount option
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
+*** User and Group quota mount options
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (34567) Gid: (76543)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (56789) Gid: (98765)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+ File: "<MOUNT>/testfile"
+ Size: 0 Filetype: Regular File
+ Mode: (0644/-rw-r--r--) Uid: (12345) Gid: (54321)
+Device: <DEVICE> Inode: <INODE> Links: 1 
+
diff --git a/tests/xfs/381 b/tests/xfs/381
new file mode 100755
index 0000000..da18a32
--- /dev/null
+++ b/tests/xfs/381
@@ -0,0 +1,95 @@
+#! /bin/bash
+# FS QA Test No. 118
+#
+# To test out pv#940675 crash in xfs_trans_brelse + quotas
+# Without the fix, this will create an ASSERT failure in debug kernels
+# and crash a non-debug kernel.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2000-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
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/quota
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_supported_os IRIX Linux
+
+_require_scratch
+_require_quota
+_require_xfs_quota_foreign
+
+_chowning_file()
+{
+	file=file.chown
+	let start=$1
+	let limit=$2
+	let delta=$3
+
+	cd $SCRATCH_MNT
+	let count=$start
+	while (( count < limit )); do
+	    touch $file
+	    chown $count.$count $file
+	    echo -n "."
+	    let count=count+delta
+	done
+	echo ""
+}
+
+echo "mkfs on scratch"
+_scratch_mkfs >$seqres.full
+
+echo "mount with quotas"
+export MOUNT_OPTIONS="-o usrquota"
+_scratch_mount
+
+echo "creating quota file with holes"
+_chowning_file 1000 2000 100
+
+echo "now fill in the holes"
+_chowning_file 1000 2000 1
+
+echo "look at the final file ownership for fun"
+ls -l $SCRATCH_MNT/* \
+| $AWK_PROG 'NF > 2 {print $3, $4, $NF}' \
+| sed "s#$SCRATCH_MNT#SCRATCH_MNT#g"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/381.out b/tests/xfs/381.out
new file mode 100644
index 0000000..5cdb694
--- /dev/null
+++ b/tests/xfs/381.out
@@ -0,0 +1,9 @@
+QA output created by 118
+mkfs on scratch
+mount with quotas
+creating quota file with holes
+..........
+now fill in the holes
+........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
+look at the final file ownership for fun
+1999 1999 SCRATCH_MNT/file.chown
diff --git a/tests/xfs/382 b/tests/xfs/382
new file mode 100755
index 0000000..6b6a12f
--- /dev/null
+++ b/tests/xfs/382
@@ -0,0 +1,82 @@
+#! /bin/bash
+# FS QA Test 138
+#
+# Test xfs_quota when user or names beginning with digits.
+# For example, create a 'limit' for a user or group named
+# '12345678-abcd', then query this user and group.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2015 Red Hat 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
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/quota
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_require_xfs_quota_foreign
+
+# need user and group named 123456-fsgqa
+_require_user 123456-fsgqa
+_require_group 123456-fsgqa
+
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "usrquota,grpquota"
+_qmount
+
+# user test
+echo "== user test =="
+$XFS_QUOTA_PROG -x -c "limit -u bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
+echo "=== quota command output ==="
+$XFS_QUOTA_PROG -c "quota -u -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
+echo "=== report command output ==="
+$XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
+
+# group test
+echo "== group test =="
+$XFS_QUOTA_PROG -x -c "limit -g bsoft=100m bhard=200m 123456-fsgqa" $SCRATCH_MNT
+echo "=== quota command output ==="
+$XFS_QUOTA_PROG -c "quota -g -b -N -v 123456-fsgqa" $SCRATCH_MNT | _filter_quota
+echo "=== report command output ==="
+$XFS_QUOTA_PROG -x -c "report -u -b -N" $SCRATCH_MNT | grep -v "^root " | _filter_quota
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/382.out b/tests/xfs/382.out
new file mode 100644
index 0000000..71929c4
--- /dev/null
+++ b/tests/xfs/382.out
@@ -0,0 +1,13 @@
+QA output created by 138
+== user test ==
+=== quota command output ===
+SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
+=== report command output ===
+123456-fsgqa 0 102400 204800 00 [--------]
+
+== group test ==
+=== quota command output ===
+SCRATCH_DEV 0 102400 204800 00 [--------] SCRATCH_MNT
+=== report command output ===
+123456-fsgqa 0 102400 204800 00 [--------]
+
diff --git a/tests/xfs/383 b/tests/xfs/383
new file mode 100755
index 0000000..a2bc3ce
--- /dev/null
+++ b/tests/xfs/383
@@ -0,0 +1,120 @@
+#! /bin/bash
+# FS QA Test 260
+#
+# When default quota is set, all different quota types inherits the
+# same default value, include group quota. So if a user quota limit
+# larger than the default user quota value, it will still be limited
+# by the group default quota value.
+#
+# There's a patch from Upstream can fix this bug:
+#
+#    [PATCH] xfs: Split default quota limits by quota type V4
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Red Hat, 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
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/quota
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_quota
+_require_xfs_quota_foreign
+_require_user
+_require_group
+
+do_test()
+{
+	local qname=$1
+	local type
+
+	if [ "$qname" = "user" ];then
+		type="-u"
+		echo "=== user quota test ==="
+	elif [ "$qname" = "group" ];then
+		type="-g"
+		echo "=== group quota test ==="
+	else
+		echo "wrong quota type name - $qname"
+		return 1
+	fi
+
+	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
+	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
+	echo "$qname blocks and inode limit"
+	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
+
+	## blocks default quota test ##
+	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
+	echo "$qname blocks quota after write 30M data"
+	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
+
+	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
+
+	## inode default quota test ##
+	for ((i=0; i<30; i++));do
+		_user_do "echo -n > ${SCRATCH_MNT}/file${i}"
+	done
+	sync
+
+	echo "$qname inode quota after creating 30 inodes"
+	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
+
+	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
+}
+
+### user default quota test ###
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "usrquota,grpquota"
+_qmount
+
+do_test user
+
+### group default quota test ###
+_scratch_unmount
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "grpquota,usrquota"
+_qmount
+
+do_test group
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/383.out b/tests/xfs/383.out
new file mode 100644
index 0000000..5eb1070
--- /dev/null
+++ b/tests/xfs/383.out
@@ -0,0 +1,25 @@
+QA output created by 260
+=== user quota test ===
+user blocks and inode limit
+fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
+
+wrote 31457280/31457280 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+user blocks quota after write 30M data
+fsgqa 30720 40960 40960 00 [--------]
+
+user inode quota after creating 30 inodes
+fsgqa 30 40 40 00 [--------]
+
+=== group quota test ===
+group blocks and inode limit
+fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
+
+wrote 31457280/31457280 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+group blocks quota after write 30M data
+fsgqa 30720 40960 40960 00 [--------]
+
+group inode quota after creating 30 inodes
+fsgqa 30 40 40 00 [--------]
+
diff --git a/tests/xfs/group b/tests/xfs/group
index baa0ff6..27a543a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -51,7 +51,6 @@
 051 auto log metadata
 052 quota db auto quick
 053 attr acl repair quick auto
-054 quota auto quick
 055 dump ioctl remote tape
 056 dump ioctl auto quick
 057 acl auto
@@ -115,7 +114,6 @@
 115 parent attr
 116 quota auto quick
 117 fuzzers
-118 quota auto quick
 119 log v2log auto freeze dangerous
 120 fuzzers
 121 log auto quick
@@ -135,7 +133,6 @@
 135 auto logprint quick v2log
 136 attr2
 137 auto metadata v2log
-138 auto quick quota
 139 auto quick clone
 140 auto clone
 141 auto log metadata
@@ -257,7 +254,6 @@
 257 auto quick clone
 258 auto quick clone
 259 auto quick
-260 auto quick quota
 261 auto quick quota
 262 auto quick quota
 263 auto quick quota


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] move now-generic quota tests to generic
  2016-09-20 22:24 ` [PATCH 3/3] move now-generic quota tests to generic Eric Sandeen
@ 2016-09-20 23:40   ` Dave Chinner
  2016-09-21  1:41     ` Eric Sandeen
  2016-09-21  6:44     ` Eryu Guan
  0 siblings, 2 replies; 15+ messages in thread
From: Dave Chinner @ 2016-09-20 23:40 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Tue, Sep 20, 2016 at 05:24:59PM -0500, Eric Sandeen wrote:
> Now that these tests have been made generic, move them into
> the generic/ dir and update group files.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

I wonder if this would be better done simply as a tools/mvtest
script for the maintainer to run. e.g.

#!/bin/sh

tools/mvtest xfs/054 generic/380
tools/mvtest xfs/118 generic/381
tools/mvtest xfs/138 generic/382
tools/mvtest xfs/260 generic/383

#EOF

Rather than ending up with patch that won't apply because we've
already applied another patch that added a new test that conflicts?
Reviewing the change is also heaps easier :)

> ---
> 
> diff --git a/tests/generic/group b/tests/generic/group
> index a602b01..f5ebbb1 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -381,3 +381,8 @@
>  376 auto quick metadata
>  377 attr auto quick metadata
>  378 auto quick metadata
> +380 quota auto quick
> +381 quota auto quick
> +382 auto quick quota
> +383 auto quick quota
> +

No trailing blank line....

> @@ -257,7 +254,6 @@
>  257 auto quick clone
>  258 auto quick clone
>  259 auto quick
> -260 auto quick quota
>  261 auto quick quota
>  262 auto quick quota
>  263 auto quick quota
> 
> N?????r??y????b?X??ǧv?^?)޺{.n?+????׬?ȧ?\x17??ܨ}???Ơz?&j:+v???\a????zZ+??+zf???h???~????i???z?\x1e?w?????????&?)ߢ^[f

Ummm, what? That looks like some kind of corruption occurred in
transit. There's no mailing list footer, and it's not at my end as
it's in the archive copies, too....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] move now-generic quota tests to generic
  2016-09-20 23:40   ` Dave Chinner
@ 2016-09-21  1:41     ` Eric Sandeen
  2016-09-21  6:44     ` Eryu Guan
  1 sibling, 0 replies; 15+ messages in thread
From: Eric Sandeen @ 2016-09-21  1:41 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Eric Sandeen, fstests

On 9/20/16 6:40 PM, Dave Chinner wrote:
> On Tue, Sep 20, 2016 at 05:24:59PM -0500, Eric Sandeen wrote:
>> Now that these tests have been made generic, move them into
>> the generic/ dir and update group files.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> I wonder if this would be better done simply as a tools/mvtest
> script for the maintainer to run. e.g.
> 
> #!/bin/sh
> 
> tools/mvtest xfs/054 generic/380
> tools/mvtest xfs/118 generic/381
> tools/mvtest xfs/138 generic/382
> tools/mvtest xfs/260 generic/383
> 
> #EOF
> 
> Rather than ending up with patch that won't apply because we've
> already applied another patch that added a new test that conflicts?
> Reviewing the change is also heaps easier :)

Oh, yeah.  I didn't know that script existed.

...

>>
>> N?????r??y????b?X??ǧv?^?)޺{.n?+????׬?ȧ?\x17??ܨ}???Ơz?&j:+v???\a????zZ+??+zf???h???~????i???z?\x1e?w?????????&?)ߢ^[f
> 
> Ummm, what? That looks like some kind of corruption occurred in
> transit. There's no mailing list footer, and it's not at my end as
> it's in the archive copies, too....

Huh, strange - not sure what to make of that.  But I guess the mvtest bit
can make it not matter.  ;)

Honestly I don't care where they land, and I don't know what else is in flight;
maybe patch 3 should be "please move these to generic as you see fit?" :)

-Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] move now-generic quota tests to generic
  2016-09-20 23:40   ` Dave Chinner
  2016-09-21  1:41     ` Eric Sandeen
@ 2016-09-21  6:44     ` Eryu Guan
  1 sibling, 0 replies; 15+ messages in thread
From: Eryu Guan @ 2016-09-21  6:44 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Eric Sandeen, Eric Sandeen, fstests

On Wed, Sep 21, 2016 at 09:40:48AM +1000, Dave Chinner wrote:
> On Tue, Sep 20, 2016 at 05:24:59PM -0500, Eric Sandeen wrote:
> > Now that these tests have been made generic, move them into
> > the generic/ dir and update group files.
> > 
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> I wonder if this would be better done simply as a tools/mvtest
> script for the maintainer to run. e.g.
> 
> #!/bin/sh
> 
> tools/mvtest xfs/054 generic/380
> tools/mvtest xfs/118 generic/381
> tools/mvtest xfs/138 generic/382
> tools/mvtest xfs/260 generic/383
> 
> #EOF
> 
> Rather than ending up with patch that won't apply because we've
> already applied another patch that added a new test that conflicts?
> Reviewing the change is also heaps easier :)

Either way is OK for me. Usually it's not a big problem, I always have
to renumber tests and resolve the conflicts. And as this patch doesn't
apply due to the patch corruption at the end, I re-did the patch by
running mvtest script.

> 
> > ---
> > 
> > diff --git a/tests/generic/group b/tests/generic/group
> > index a602b01..f5ebbb1 100644
> > --- a/tests/generic/group
> > +++ b/tests/generic/group
> > @@ -381,3 +381,8 @@
> >  376 auto quick metadata
> >  377 attr auto quick metadata
> >  378 auto quick metadata
> > +380 quota auto quick

I re-numbered them starting from 379.

> > +381 quota auto quick
> > +382 auto quick quota
> > +383 auto quick quota
> > +
> 
> No trailing blank line....

Fixed at commit time. And start testing them now.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems
  2016-09-20 22:21 ` [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems Eric Sandeen
@ 2016-09-21  9:37   ` Eryu Guan
  2016-09-21 13:02     ` Eric Sandeen
  2016-09-22 14:09   ` Bill O'Donnell
  2016-09-22 18:54   ` [PATCH 2/3 V2] " Eric Sandeen
  2 siblings, 1 reply; 15+ messages in thread
From: Eryu Guan @ 2016-09-21  9:37 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Tue, Sep 20, 2016 at 05:21:46PM -0500, Eric Sandeen wrote:
> Fix several xfs quota tests to work on non-xfs filesystems.
> 
> New _require function to be sure that the xfs_quota tool can operate
> on foreign filesystems; if it can, and if it needs to, it adds "-f"
> to the XFS_QUOTA_PROG variable.
> 
> Modify _qmount to do quotacheck/quotaon to mount and /enable/
> quota.  On xfs this isn't needed and/or fails; it's ignored.
> 
> All quota-related options used as arguments to _qmount are changed
> from i.e. uquota to i.e. usrquota; the latter is standard across
> almost all linux filesytems, including xfs.
> 
> xfs/260 filters out the root/default quota line, because ext4
> consumes a different amount of space than xfs, and it's not what
> we're testing for, so just ignore it.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> diff --git a/common/quota b/common/quota
> index d91062a..2ec56a5 100644
> --- a/common/quota
> +++ b/common/quota
> @@ -78,6 +78,19 @@ _require_xfs_quota()
>  }
>  
>  #
> +# checks that xfs_quota can operate on foreign (non-xfs) filesystems
> +# Skips check on xfs filesystems, old xfs_quota is fine there.
> +# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
> +#
> +_require_xfs_quota_foreign()
> +{
> +    if [ "$FSTYP" != "xfs" ]; then
> +	$XFS_QUOTA_PROG -f -V &>/dev/null || \
> +		_notrun "xfs_quota binary does not support foreign filesystems"
> +	XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
> +    fi

Mixing space and tab in this function.

> +}

Better to have an empty line here :)

> +#
>  # checks that the XFS project quota support in the kernel is enabled.
>  #
>  _require_prjquota()

[snip]

> diff --git a/tests/xfs/118 b/tests/xfs/118
> index 8414594..da18a32 100755
> --- a/tests/xfs/118
> +++ b/tests/xfs/118
> @@ -47,11 +47,12 @@ _cleanup()
>  # real QA test starts here
>  
>  # Modify as appropriate.
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os IRIX Linux
>  
>  _require_scratch
> -_require_xfs_quota
> +_require_quota
> +_require_xfs_quota_foreign
>  
>  _chowning_file()
>  {
> @@ -72,10 +73,10 @@ _chowning_file()
>  }
>  
>  echo "mkfs on scratch"
> -_scratch_mkfs_xfs >$seqres.full
> +_scratch_mkfs >$seqres.full

I found that stderr should be redirected to $seqres.full too, otherwise
it fails with ext2/3 as

+mke2fs 1.42.9 (28-Dec-2013)

I can fix them at commit time if there's no other review comments.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems
  2016-09-21  9:37   ` Eryu Guan
@ 2016-09-21 13:02     ` Eric Sandeen
  2016-09-21 14:30       ` Eryu Guan
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Sandeen @ 2016-09-21 13:02 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Eric Sandeen, fstests

On 9/21/16 4:37 AM, Eryu Guan wrote:
> On Tue, Sep 20, 2016 at 05:21:46PM -0500, Eric Sandeen wrote:
>> Fix several xfs quota tests to work on non-xfs filesystems.
>>
>> New _require function to be sure that the xfs_quota tool can operate
>> on foreign filesystems; if it can, and if it needs to, it adds "-f"
>> to the XFS_QUOTA_PROG variable.
>>
>> Modify _qmount to do quotacheck/quotaon to mount and /enable/
>> quota.  On xfs this isn't needed and/or fails; it's ignored.
>>
>> All quota-related options used as arguments to _qmount are changed
>> from i.e. uquota to i.e. usrquota; the latter is standard across
>> almost all linux filesytems, including xfs.
>>
>> xfs/260 filters out the root/default quota line, because ext4
>> consumes a different amount of space than xfs, and it's not what
>> we're testing for, so just ignore it.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> diff --git a/common/quota b/common/quota
>> index d91062a..2ec56a5 100644
>> --- a/common/quota
>> +++ b/common/quota
>> @@ -78,6 +78,19 @@ _require_xfs_quota()
>>  }
>>  
>>  #
>> +# checks that xfs_quota can operate on foreign (non-xfs) filesystems
>> +# Skips check on xfs filesystems, old xfs_quota is fine there.
>> +# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
>> +#
>> +_require_xfs_quota_foreign()
>> +{
>> +    if [ "$FSTYP" != "xfs" ]; then
>> +	$XFS_QUOTA_PROG -f -V &>/dev/null || \
>> +		_notrun "xfs_quota binary does not support foreign filesystems"
>> +	XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
>> +    fi
> 
> Mixing space and tab in this function.

yep -

As do the functions before and after it - are we going with a strict
rule now or going for consistency with the rest of the code?

If you really want a strict tabs-only rule I'd suggest re-tabbing the
entire file to avoid this coming up over and over.  :)

>> +}
> 
> Better to have an empty line here :)

Yep :)

>> +#
>>  # checks that the XFS project quota support in the kernel is enabled.
>>  #
>>  _require_prjquota()
> 
> [snip]
> 
>> diff --git a/tests/xfs/118 b/tests/xfs/118
>> index 8414594..da18a32 100755
>> --- a/tests/xfs/118
>> +++ b/tests/xfs/118
>> @@ -47,11 +47,12 @@ _cleanup()
>>  # real QA test starts here
>>  
>>  # Modify as appropriate.
>> -_supported_fs xfs
>> +_supported_fs generic
>>  _supported_os IRIX Linux
>>  
>>  _require_scratch
>> -_require_xfs_quota
>> +_require_quota
>> +_require_xfs_quota_foreign
>>  
>>  _chowning_file()
>>  {
>> @@ -72,10 +73,10 @@ _chowning_file()
>>  }
>>  
>>  echo "mkfs on scratch"
>> -_scratch_mkfs_xfs >$seqres.full
>> +_scratch_mkfs >$seqres.full
> 
> I found that stderr should be redirected to $seqres.full too, otherwise
> it fails with ext2/3 as
> 
> +mke2fs 1.42.9 (28-Dec-2013)
> 
> I can fix them at commit time if there's no other review comments.

hm, ok thanks.  Not sure how I missed that, unless newer e2fsprogs
doesn't go to stderr (I was testing with 1.43.x)

Thanks,
-Eric

> Thanks,
> Eryu
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems
  2016-09-21 13:02     ` Eric Sandeen
@ 2016-09-21 14:30       ` Eryu Guan
  2016-09-21 14:52         ` Eric Sandeen
  0 siblings, 1 reply; 15+ messages in thread
From: Eryu Guan @ 2016-09-21 14:30 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Wed, Sep 21, 2016 at 08:02:39AM -0500, Eric Sandeen wrote:
> >>  #
> >> +# checks that xfs_quota can operate on foreign (non-xfs) filesystems
> >> +# Skips check on xfs filesystems, old xfs_quota is fine there.
> >> +# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
> >> +#
> >> +_require_xfs_quota_foreign()
> >> +{
> >> +    if [ "$FSTYP" != "xfs" ]; then
> >> +	$XFS_QUOTA_PROG -f -V &>/dev/null || \
> >> +		_notrun "xfs_quota binary does not support foreign filesystems"
> >> +	XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
> >> +    fi
> > 
> > Mixing space and tab in this function.
> 
> yep -
> 
> As do the functions before and after it - are we going with a strict
> rule now or going for consistency with the rest of the code?

I think currently the rule is that we use tab as indentions for new
code, e.g. new functions, new tests, as long as the new code doesn't mix
with existing code. And we only go for the consistency when modifying
old code with spaces as indention.

I just searched for Dave's explanation, hope this explains better than
my words :)

   - some of the code uses 4 space tabs. When adding code into
     such functions, please use 4 space tabs. New code should
     use 8 space tabs, but only if it's not surrounded by code
     that is using 4 space tabs.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems
  2016-09-21 14:30       ` Eryu Guan
@ 2016-09-21 14:52         ` Eric Sandeen
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Sandeen @ 2016-09-21 14:52 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Eric Sandeen, fstests



On 9/21/16 9:30 AM, Eryu Guan wrote:
> On Wed, Sep 21, 2016 at 08:02:39AM -0500, Eric Sandeen wrote:
>>>>  #
>>>> +# checks that xfs_quota can operate on foreign (non-xfs) filesystems
>>>> +# Skips check on xfs filesystems, old xfs_quota is fine there.
>>>> +# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
>>>> +#
>>>> +_require_xfs_quota_foreign()
>>>> +{
>>>> +    if [ "$FSTYP" != "xfs" ]; then
>>>> +	$XFS_QUOTA_PROG -f -V &>/dev/null || \
>>>> +		_notrun "xfs_quota binary does not support foreign filesystems"
>>>> +	XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
>>>> +    fi
>>>
>>> Mixing space and tab in this function.
>>
>> yep -
>>
>> As do the functions before and after it - are we going with a strict
>> rule now or going for consistency with the rest of the code?
> 
> I think currently the rule is that we use tab as indentions for new
> code, e.g. new functions, new tests, as long as the new code doesn't mix
> with existing code. And we only go for the consistency when modifying
> old code with spaces as indention.
> 
> I just searched for Dave's explanation, hope this explains better than
> my words :)
> 
>    - some of the code uses 4 space tabs. When adding code into
>      such functions, please use 4 space tabs. New code should
>      use 8 space tabs, but only if it's not surrounded by code
>      that is using 4 space tabs.

Ok, fair enough.  I still think it may be worth just re-tabbing everything,
most people modifying this stuff won't be looking for old emails, they'll
be looking at the current convention present in the code they are modifying.  :)

Thanks,
-Eric

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/3] xfs/260: fix output to match actions
  2016-09-20 22:15 ` [PATCH 1/3] xfs/260: fix output to match actions Eric Sandeen
@ 2016-09-22 14:07   ` Bill O'Donnell
  0 siblings, 0 replies; 15+ messages in thread
From: Bill O'Donnell @ 2016-09-22 14:07 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Tue, Sep 20, 2016 at 05:15:47PM -0500, Eric Sandeen wrote:
> The test creates 30 inodes, but says it created 300.
> Just fix that up so the repquota output matches the
> comments in the output file.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> diff --git a/tests/xfs/260 b/tests/xfs/260
> index 70486ac..9c6162b 100755
> --- a/tests/xfs/260
> +++ b/tests/xfs/260
> @@ -93,7 +93,7 @@ do_test()
>  	done
>  	sync
>  
> -	echo "$qname inode quota after create 300 inodes"
> +	echo "$qname inode quota after creating 30 inodes"
>  	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
>  
>  	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
> index 4965eeb..0b198bf 100644
> --- a/tests/xfs/260.out
> +++ b/tests/xfs/260.out
> @@ -10,7 +10,7 @@ user blocks quota after write 30M data
>  root 0 20480 20480 00 [--------]
>  fsgqa 30720 40960 40960 00 [--------]
>  
> -user inode quota after create 300 inodes
> +user inode quota after creating 30 inodes
>  root 3 20 20 00 [--------]
>  fsgqa 30 40 40 00 [--------]
>  
> @@ -25,7 +25,7 @@ group blocks quota after write 30M data
>  root 0 20480 20480 00 [--------]
>  fsgqa 30720 40960 40960 00 [--------]
>  
> -group inode quota after create 300 inodes
> +group inode quota after creating 30 inodes
>  root 3 20 20 00 [--------]
>  fsgqa 30 40 40 00 [--------]
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems
  2016-09-20 22:21 ` [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems Eric Sandeen
  2016-09-21  9:37   ` Eryu Guan
@ 2016-09-22 14:09   ` Bill O'Donnell
  2016-09-22 18:54   ` [PATCH 2/3 V2] " Eric Sandeen
  2 siblings, 0 replies; 15+ messages in thread
From: Bill O'Donnell @ 2016-09-22 14:09 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Tue, Sep 20, 2016 at 05:21:46PM -0500, Eric Sandeen wrote:
> Fix several xfs quota tests to work on non-xfs filesystems.
> 
> New _require function to be sure that the xfs_quota tool can operate
> on foreign filesystems; if it can, and if it needs to, it adds "-f"
> to the XFS_QUOTA_PROG variable.
> 
> Modify _qmount to do quotacheck/quotaon to mount and /enable/
> quota.  On xfs this isn't needed and/or fails; it's ignored.
> 
> All quota-related options used as arguments to _qmount are changed
> from i.e. uquota to i.e. usrquota; the latter is standard across
> almost all linux filesytems, including xfs.
> 
> xfs/260 filters out the root/default quota line, because ext4
> consumes a different amount of space than xfs, and it's not what
> we're testing for, so just ignore it.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> diff --git a/common/quota b/common/quota
> index d91062a..2ec56a5 100644
> --- a/common/quota
> +++ b/common/quota
> @@ -78,6 +78,19 @@ _require_xfs_quota()
>  }
>  
>  #
> +# checks that xfs_quota can operate on foreign (non-xfs) filesystems
> +# Skips check on xfs filesystems, old xfs_quota is fine there.
> +# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
> +#
> +_require_xfs_quota_foreign()
> +{
> +    if [ "$FSTYP" != "xfs" ]; then
> +	$XFS_QUOTA_PROG -f -V &>/dev/null || \
> +		_notrun "xfs_quota binary does not support foreign filesystems"
> +	XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
> +    fi
> +}
> +#
>  # checks that the XFS project quota support in the kernel is enabled.
>  #
>  _require_prjquota()
> @@ -169,6 +182,10 @@ _qmount()
>  {
>      _scratch_unmount >/dev/null 2>&1
>      _scratch_mount || _fail "qmount failed"
> +    # xfs doesn't need these setups and quotacheck even fails on xfs, so just
> +    # redirect the output to $seqres.full for debug purpose and ignore the results
> +    quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
> +    quotaon -u -g $SCRATCH_MNT >>$seqres.full 2>&1
>      chmod ugo+rwx $SCRATCH_MNT
>  }
>  
> diff --git a/tests/xfs/054 b/tests/xfs/054
> index ea0f9f8..b4e5dd1 100755
> --- a/tests/xfs/054
> +++ b/tests/xfs/054
> @@ -44,14 +44,15 @@ _cleanup()
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  # real QA test starts here
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux IRIX
>  
>  cp /dev/null $seqres.full
>  chmod ugo+rwx $seqres.full
>  
>  _require_scratch
> -_require_xfs_quota
> +_require_quota
> +_require_xfs_quota_foreign
>  
>  _filter_stat()
>  {
> @@ -67,7 +68,7 @@ _filter_stat()
>  
>  _exercise()
>  {
> -	_scratch_mkfs_xfs >/dev/null 2>&1
> +	_scratch_mkfs >/dev/null 2>&1
>  	_qmount
>  
>  	umask 022
> @@ -99,9 +100,9 @@ _exercise()
>  	_scratch_unmount 2>/dev/null
>  }
>  
> -_scratch_mkfs_xfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
> +_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
>  
> -_qmount_option "uquota,gquota"
> +_qmount_option "usrquota,grpquota"
>  _qmount
>  if src/feature -G $SCRATCH_DEV ; then
>  	:
> @@ -114,16 +115,15 @@ _qmount_option "rw" # no quota options
>  echo "*** Default mount options"
>  _exercise
>  
> -_qmount_option "uquota"
> +_qmount_option "usrquota"
>  echo "*** User quota mount option"
>  _exercise
>  
> -export MOUNT_OPTIONS="-o gquota"
> -_qmount_option "gquota"
> +_qmount_option "grpquota"
>  echo "*** Group quota mount option"
>  _exercise
>  
> -_qmount_option "uquota,gquota"
> +_qmount_option "usrquota,grpquota"
>  echo "*** User and Group quota mount options"
>  _exercise
>  
> diff --git a/tests/xfs/118 b/tests/xfs/118
> index 8414594..da18a32 100755
> --- a/tests/xfs/118
> +++ b/tests/xfs/118
> @@ -47,11 +47,12 @@ _cleanup()
>  # real QA test starts here
>  
>  # Modify as appropriate.
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os IRIX Linux
>  
>  _require_scratch
> -_require_xfs_quota
> +_require_quota
> +_require_xfs_quota_foreign
>  
>  _chowning_file()
>  {
> @@ -72,10 +73,10 @@ _chowning_file()
>  }
>  
>  echo "mkfs on scratch"
> -_scratch_mkfs_xfs >$seqres.full
> +_scratch_mkfs >$seqres.full
>  
>  echo "mount with quotas"
> -export MOUNT_OPTIONS="-o uquota"
> +export MOUNT_OPTIONS="-o usrquota"
>  _scratch_mount
>  
>  echo "creating quota file with holes"
> diff --git a/tests/xfs/138 b/tests/xfs/138
> index c6a6f50..6b6a12f 100755
> --- a/tests/xfs/138
> +++ b/tests/xfs/138
> @@ -47,17 +47,18 @@ _cleanup()
>  rm -f $seqres.full
>  
>  # real QA test starts here
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux
>  _require_scratch
>  _require_quota
> +_require_xfs_quota_foreign
>  
>  # need user and group named 123456-fsgqa
>  _require_user 123456-fsgqa
>  _require_group 123456-fsgqa
>  
> -_scratch_mkfs_xfs >/dev/null 2>&1
> -_qmount_option "uquota,gquota"
> +_scratch_mkfs >/dev/null 2>&1
> +_qmount_option "usrquota,grpquota"
>  _qmount
>  
>  # user test
> diff --git a/tests/xfs/260 b/tests/xfs/260
> index 9c6162b..a2bc3ce 100755
> --- a/tests/xfs/260
> +++ b/tests/xfs/260
> @@ -52,10 +52,11 @@ _cleanup()
>  rm -f $seqres.full
>  
>  # real QA test starts here
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux
>  _require_scratch
>  _require_quota
> +_require_xfs_quota_foreign
>  _require_user
>  _require_group
>  
> @@ -78,12 +79,12 @@ do_test()
>  	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
>  	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
>  	echo "$qname blocks and inode limit"
> -	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | _filter_spaces
> +	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
>  
>  	## blocks default quota test ##
>  	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
>  	echo "$qname blocks quota after write 30M data"
> -	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | _filter_spaces
> +	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
>  
>  	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
>  
> @@ -94,22 +95,22 @@ do_test()
>  	sync
>  
>  	echo "$qname inode quota after creating 30 inodes"
> -	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
> +	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
>  
>  	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
>  }
>  
>  ### user default quota test ###
> -_scratch_mkfs_xfs >/dev/null 2>&1
> -_qmount_option "uquota,gquota"
> +_scratch_mkfs >/dev/null 2>&1
> +_qmount_option "usrquota,grpquota"
>  _qmount
>  
>  do_test user
>  
>  ### group default quota test ###
>  _scratch_unmount
> -_scratch_mkfs_xfs >/dev/null 2>&1
> -_qmount_option "gquota,uquota"
> +_scratch_mkfs >/dev/null 2>&1
> +_qmount_option "grpquota,usrquota"
>  _qmount
>  
>  do_test group
> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
> index 0b198bf..5eb1070 100644
> --- a/tests/xfs/260.out
> +++ b/tests/xfs/260.out
> @@ -1,31 +1,25 @@
>  QA output created by 260
>  === user quota test ===
>  user blocks and inode limit
> -root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
>  fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
>  
>  wrote 31457280/31457280 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  user blocks quota after write 30M data
> -root 0 20480 20480 00 [--------]
>  fsgqa 30720 40960 40960 00 [--------]
>  
>  user inode quota after creating 30 inodes
> -root 3 20 20 00 [--------]
>  fsgqa 30 40 40 00 [--------]
>  
>  === group quota test ===
>  group blocks and inode limit
> -root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
>  fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
>  
>  wrote 31457280/31457280 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  group blocks quota after write 30M data
> -root 0 20480 20480 00 [--------]
>  fsgqa 30720 40960 40960 00 [--------]
>  
>  group inode quota after creating 30 inodes
> -root 3 20 20 00 [--------]
>  fsgqa 30 40 40 00 [--------]
>  
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/3 V2] modify xfs/ quota tests to work on generic filesystems
  2016-09-20 22:21 ` [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems Eric Sandeen
  2016-09-21  9:37   ` Eryu Guan
  2016-09-22 14:09   ` Bill O'Donnell
@ 2016-09-22 18:54   ` Eric Sandeen
  2016-09-22 18:57     ` Bill O'Donnell
  2 siblings, 1 reply; 15+ messages in thread
From: Eric Sandeen @ 2016-09-22 18:54 UTC (permalink / raw)
  To: Eric Sandeen, fstests

Fix several xfs quota tests to work on non-xfs filesystems.

New _require function to be sure that the xfs_quota tool can operate
on foreign filesystems; if it can, and if it needs to, it adds "-f"
to the XFS_QUOTA_PROG variable.

Modify _qmount to do quotacheck/quotaon to mount and /enable/
quota.  On xfs this isn't needed and/or fails; it's ignored.

All quota-related options used as arguments to _qmount are changed
from i.e. uquota to i.e. usrquota; the latter is standard across
almost all linux filesytems, including xfs.

xfs/260 filters out the root/default quota line, because ext4
consumes a different amount of space than xfs, and it's not what
we're testing for, so just ignore it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2:

* only do quotaon for non-xfs; otherwise tests that want "noenforce"
  options will fail (xfs/050, oops)

* Fix Eryu's review comments.

diff --git a/common/quota b/common/quota
index d91062a..afc1606 100644
--- a/common/quota
+++ b/common/quota
@@ -78,6 +78,20 @@ _require_xfs_quota()
 }
 
 #
+# checks that xfs_quota can operate on foreign (non-xfs) filesystems
+# Skips check on xfs filesystems, old xfs_quota is fine there.
+# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
+#
+_require_xfs_quota_foreign()
+{
+	if [ "$FSTYP" != "xfs" ]; then
+		$XFS_QUOTA_PROG -f -V &>/dev/null || \
+		 _notrun "xfs_quota binary does not support foreign filesystems"
+		XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
+	fi
+}
+
+#
 # checks that the XFS project quota support in the kernel is enabled.
 #
 _require_prjquota()
@@ -169,6 +183,12 @@ _qmount()
 {
     _scratch_unmount >/dev/null 2>&1
     _scratch_mount || _fail "qmount failed"
+    # xfs doesn't need these setups and quotacheck even fails on xfs
+    # redirect the output to $seqres.full for debug purpose and ignore results
+    if [ "$FSTYP" != "xfs" ]; then
+	quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
+	quotaon -ug $SCRATCH_MNT >>$seqres.full 2>&1
+    fi
     chmod ugo+rwx $SCRATCH_MNT
 }
 
diff --git a/tests/xfs/054 b/tests/xfs/054
index ea0f9f8..b4e5dd1 100755
--- a/tests/xfs/054
+++ b/tests/xfs/054
@@ -44,14 +44,15 @@ _cleanup()
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux IRIX
 
 cp /dev/null $seqres.full
 chmod ugo+rwx $seqres.full
 
 _require_scratch
-_require_xfs_quota
+_require_quota
+_require_xfs_quota_foreign
 
 _filter_stat()
 {
@@ -67,7 +68,7 @@ _filter_stat()
 
 _exercise()
 {
-	_scratch_mkfs_xfs >/dev/null 2>&1
+	_scratch_mkfs >/dev/null 2>&1
 	_qmount
 
 	umask 022
@@ -99,9 +100,9 @@ _exercise()
 	_scratch_unmount 2>/dev/null
 }
 
-_scratch_mkfs_xfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
+_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
 
-_qmount_option "uquota,gquota"
+_qmount_option "usrquota,grpquota"
 _qmount
 if src/feature -G $SCRATCH_DEV ; then
 	:
@@ -114,16 +115,15 @@ _qmount_option "rw" # no quota options
 echo "*** Default mount options"
 _exercise
 
-_qmount_option "uquota"
+_qmount_option "usrquota"
 echo "*** User quota mount option"
 _exercise
 
-export MOUNT_OPTIONS="-o gquota"
-_qmount_option "gquota"
+_qmount_option "grpquota"
 echo "*** Group quota mount option"
 _exercise
 
-_qmount_option "uquota,gquota"
+_qmount_option "usrquota,grpquota"
 echo "*** User and Group quota mount options"
 _exercise
 
diff --git a/tests/xfs/118 b/tests/xfs/118
index 8414594..8861108 100755
--- a/tests/xfs/118
+++ b/tests/xfs/118
@@ -47,11 +47,12 @@ _cleanup()
 # real QA test starts here
 
 # Modify as appropriate.
-_supported_fs xfs
+_supported_fs generic
 _supported_os IRIX Linux
 
 _require_scratch
-_require_xfs_quota
+_require_quota
+_require_xfs_quota_foreign
 
 _chowning_file()
 {
@@ -72,10 +73,10 @@ _chowning_file()
 }
 
 echo "mkfs on scratch"
-_scratch_mkfs_xfs >$seqres.full
+_scratch_mkfs >$seqres.full 2>&1
 
 echo "mount with quotas"
-export MOUNT_OPTIONS="-o uquota"
+export MOUNT_OPTIONS="-o usrquota"
 _scratch_mount
 
 echo "creating quota file with holes"
diff --git a/tests/xfs/138 b/tests/xfs/138
index c6a6f50..6b6a12f 100755
--- a/tests/xfs/138
+++ b/tests/xfs/138
@@ -47,17 +47,18 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_quota
+_require_xfs_quota_foreign
 
 # need user and group named 123456-fsgqa
 _require_user 123456-fsgqa
 _require_group 123456-fsgqa
 
-_scratch_mkfs_xfs >/dev/null 2>&1
-_qmount_option "uquota,gquota"
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "usrquota,grpquota"
 _qmount
 
 # user test
diff --git a/tests/xfs/260 b/tests/xfs/260
index 9c6162b..a2bc3ce 100755
--- a/tests/xfs/260
+++ b/tests/xfs/260
@@ -52,10 +52,11 @@ _cleanup()
 rm -f $seqres.full
 
 # real QA test starts here
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux
 _require_scratch
 _require_quota
+_require_xfs_quota_foreign
 _require_user
 _require_group
 
@@ -78,12 +79,12 @@ do_test()
 	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
 	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
 	echo "$qname blocks and inode limit"
-	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
 
 	## blocks default quota test ##
 	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
 	echo "$qname blocks quota after write 30M data"
-	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
 
@@ -94,22 +95,22 @@ do_test()
 	sync
 
 	echo "$qname inode quota after creating 30 inodes"
-	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
+	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
 
 	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
 }
 
 ### user default quota test ###
-_scratch_mkfs_xfs >/dev/null 2>&1
-_qmount_option "uquota,gquota"
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "usrquota,grpquota"
 _qmount
 
 do_test user
 
 ### group default quota test ###
 _scratch_unmount
-_scratch_mkfs_xfs >/dev/null 2>&1
-_qmount_option "gquota,uquota"
+_scratch_mkfs >/dev/null 2>&1
+_qmount_option "grpquota,usrquota"
 _qmount
 
 do_test group
diff --git a/tests/xfs/260.out b/tests/xfs/260.out
index 0b198bf..5eb1070 100644
--- a/tests/xfs/260.out
+++ b/tests/xfs/260.out
@@ -1,31 +1,25 @@
 QA output created by 260
 === user quota test ===
 user blocks and inode limit
-root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
 fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
 
 wrote 31457280/31457280 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 user blocks quota after write 30M data
-root 0 20480 20480 00 [--------]
 fsgqa 30720 40960 40960 00 [--------]
 
 user inode quota after creating 30 inodes
-root 3 20 20 00 [--------]
 fsgqa 30 40 40 00 [--------]
 
 === group quota test ===
 group blocks and inode limit
-root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
 fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
 
 wrote 31457280/31457280 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 group blocks quota after write 30M data
-root 0 20480 20480 00 [--------]
 fsgqa 30720 40960 40960 00 [--------]
 
 group inode quota after creating 30 inodes
-root 3 20 20 00 [--------]
 fsgqa 30 40 40 00 [--------]
 



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3 V2] modify xfs/ quota tests to work on generic filesystems
  2016-09-22 18:54   ` [PATCH 2/3 V2] " Eric Sandeen
@ 2016-09-22 18:57     ` Bill O'Donnell
  0 siblings, 0 replies; 15+ messages in thread
From: Bill O'Donnell @ 2016-09-22 18:57 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, fstests

On Thu, Sep 22, 2016 at 01:54:16PM -0500, Eric Sandeen wrote:
> Fix several xfs quota tests to work on non-xfs filesystems.
> 
> New _require function to be sure that the xfs_quota tool can operate
> on foreign filesystems; if it can, and if it needs to, it adds "-f"
> to the XFS_QUOTA_PROG variable.
> 
> Modify _qmount to do quotacheck/quotaon to mount and /enable/
> quota.  On xfs this isn't needed and/or fails; it's ignored.
> 
> All quota-related options used as arguments to _qmount are changed
> from i.e. uquota to i.e. usrquota; the latter is standard across
> almost all linux filesytems, including xfs.
> 
> xfs/260 filters out the root/default quota line, because ext4
> consumes a different amount of space than xfs, and it's not what
> we're testing for, so just ignore it.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> V2:
> 
> * only do quotaon for non-xfs; otherwise tests that want "noenforce"
>   options will fail (xfs/050, oops)
> 
> * Fix Eryu's review comments.
> 
> diff --git a/common/quota b/common/quota
> index d91062a..afc1606 100644
> --- a/common/quota
> +++ b/common/quota
> @@ -78,6 +78,20 @@ _require_xfs_quota()
>  }
>  
>  #
> +# checks that xfs_quota can operate on foreign (non-xfs) filesystems
> +# Skips check on xfs filesystems, old xfs_quota is fine there.
> +# Appends "-f" to enable foreign behavior on non-xfs filesystems if available.
> +#
> +_require_xfs_quota_foreign()
> +{
> +	if [ "$FSTYP" != "xfs" ]; then
> +		$XFS_QUOTA_PROG -f -V &>/dev/null || \
> +		 _notrun "xfs_quota binary does not support foreign filesystems"
> +		XFS_QUOTA_PROG="$XFS_QUOTA_PROG -f"
> +	fi
> +}
> +
> +#
>  # checks that the XFS project quota support in the kernel is enabled.
>  #
>  _require_prjquota()
> @@ -169,6 +183,12 @@ _qmount()
>  {
>      _scratch_unmount >/dev/null 2>&1
>      _scratch_mount || _fail "qmount failed"
> +    # xfs doesn't need these setups and quotacheck even fails on xfs
> +    # redirect the output to $seqres.full for debug purpose and ignore results
> +    if [ "$FSTYP" != "xfs" ]; then
> +	quotacheck -ug $SCRATCH_MNT >>$seqres.full 2>&1
> +	quotaon -ug $SCRATCH_MNT >>$seqres.full 2>&1
> +    fi
>      chmod ugo+rwx $SCRATCH_MNT
>  }
>  
> diff --git a/tests/xfs/054 b/tests/xfs/054
> index ea0f9f8..b4e5dd1 100755
> --- a/tests/xfs/054
> +++ b/tests/xfs/054
> @@ -44,14 +44,15 @@ _cleanup()
>  trap "_cleanup; exit \$status" 0 1 2 3 15
>  
>  # real QA test starts here
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux IRIX
>  
>  cp /dev/null $seqres.full
>  chmod ugo+rwx $seqres.full
>  
>  _require_scratch
> -_require_xfs_quota
> +_require_quota
> +_require_xfs_quota_foreign
>  
>  _filter_stat()
>  {
> @@ -67,7 +68,7 @@ _filter_stat()
>  
>  _exercise()
>  {
> -	_scratch_mkfs_xfs >/dev/null 2>&1
> +	_scratch_mkfs >/dev/null 2>&1
>  	_qmount
>  
>  	umask 022
> @@ -99,9 +100,9 @@ _exercise()
>  	_scratch_unmount 2>/dev/null
>  }
>  
> -_scratch_mkfs_xfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
> +_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed!"
>  
> -_qmount_option "uquota,gquota"
> +_qmount_option "usrquota,grpquota"
>  _qmount
>  if src/feature -G $SCRATCH_DEV ; then
>  	:
> @@ -114,16 +115,15 @@ _qmount_option "rw" # no quota options
>  echo "*** Default mount options"
>  _exercise
>  
> -_qmount_option "uquota"
> +_qmount_option "usrquota"
>  echo "*** User quota mount option"
>  _exercise
>  
> -export MOUNT_OPTIONS="-o gquota"
> -_qmount_option "gquota"
> +_qmount_option "grpquota"
>  echo "*** Group quota mount option"
>  _exercise
>  
> -_qmount_option "uquota,gquota"
> +_qmount_option "usrquota,grpquota"
>  echo "*** User and Group quota mount options"
>  _exercise
>  
> diff --git a/tests/xfs/118 b/tests/xfs/118
> index 8414594..8861108 100755
> --- a/tests/xfs/118
> +++ b/tests/xfs/118
> @@ -47,11 +47,12 @@ _cleanup()
>  # real QA test starts here
>  
>  # Modify as appropriate.
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os IRIX Linux
>  
>  _require_scratch
> -_require_xfs_quota
> +_require_quota
> +_require_xfs_quota_foreign
>  
>  _chowning_file()
>  {
> @@ -72,10 +73,10 @@ _chowning_file()
>  }
>  
>  echo "mkfs on scratch"
> -_scratch_mkfs_xfs >$seqres.full
> +_scratch_mkfs >$seqres.full 2>&1
>  
>  echo "mount with quotas"
> -export MOUNT_OPTIONS="-o uquota"
> +export MOUNT_OPTIONS="-o usrquota"
>  _scratch_mount
>  
>  echo "creating quota file with holes"
> diff --git a/tests/xfs/138 b/tests/xfs/138
> index c6a6f50..6b6a12f 100755
> --- a/tests/xfs/138
> +++ b/tests/xfs/138
> @@ -47,17 +47,18 @@ _cleanup()
>  rm -f $seqres.full
>  
>  # real QA test starts here
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux
>  _require_scratch
>  _require_quota
> +_require_xfs_quota_foreign
>  
>  # need user and group named 123456-fsgqa
>  _require_user 123456-fsgqa
>  _require_group 123456-fsgqa
>  
> -_scratch_mkfs_xfs >/dev/null 2>&1
> -_qmount_option "uquota,gquota"
> +_scratch_mkfs >/dev/null 2>&1
> +_qmount_option "usrquota,grpquota"
>  _qmount
>  
>  # user test
> diff --git a/tests/xfs/260 b/tests/xfs/260
> index 9c6162b..a2bc3ce 100755
> --- a/tests/xfs/260
> +++ b/tests/xfs/260
> @@ -52,10 +52,11 @@ _cleanup()
>  rm -f $seqres.full
>  
>  # real QA test starts here
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux
>  _require_scratch
>  _require_quota
> +_require_xfs_quota_foreign
>  _require_user
>  _require_group
>  
> @@ -78,12 +79,12 @@ do_test()
>  	$XFS_QUOTA_PROG -x -c "limit bsoft=20M bhard=20M isoft=20 ihard=20 $type -d" $SCRATCH_MNT
>  	$XFS_QUOTA_PROG -x -c "limit bsoft=40M bhard=40M isoft=40 ihard=40 $type fsgqa" $SCRATCH_MNT
>  	echo "$qname blocks and inode limit"
> -	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | _filter_spaces
> +	$XFS_QUOTA_PROG -x -c "report $type -N -bi" $SCRATCH_MNT | grep -v ^root | _filter_spaces
>  
>  	## blocks default quota test ##
>  	_user_do "$XFS_IO_PROG -f -c \"pwrite 0 30M\" -c \"fsync\" $SCRATCH_MNT/data" | _filter_xfs_io
>  	echo "$qname blocks quota after write 30M data"
> -	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | _filter_spaces
> +	$XFS_QUOTA_PROG -x -c "report $type -N -b" $SCRATCH_MNT | grep -v ^root | _filter_spaces
>  
>  	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
>  
> @@ -94,22 +95,22 @@ do_test()
>  	sync
>  
>  	echo "$qname inode quota after creating 30 inodes"
> -	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | _filter_spaces
> +	$XFS_QUOTA_PROG -x -c "report $type -N -i" $SCRATCH_MNT | grep -v ^root | _filter_spaces
>  
>  	rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
>  }
>  
>  ### user default quota test ###
> -_scratch_mkfs_xfs >/dev/null 2>&1
> -_qmount_option "uquota,gquota"
> +_scratch_mkfs >/dev/null 2>&1
> +_qmount_option "usrquota,grpquota"
>  _qmount
>  
>  do_test user
>  
>  ### group default quota test ###
>  _scratch_unmount
> -_scratch_mkfs_xfs >/dev/null 2>&1
> -_qmount_option "gquota,uquota"
> +_scratch_mkfs >/dev/null 2>&1
> +_qmount_option "grpquota,usrquota"
>  _qmount
>  
>  do_test group
> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
> index 0b198bf..5eb1070 100644
> --- a/tests/xfs/260.out
> +++ b/tests/xfs/260.out
> @@ -1,31 +1,25 @@
>  QA output created by 260
>  === user quota test ===
>  user blocks and inode limit
> -root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
>  fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
>  
>  wrote 31457280/31457280 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  user blocks quota after write 30M data
> -root 0 20480 20480 00 [--------]
>  fsgqa 30720 40960 40960 00 [--------]
>  
>  user inode quota after creating 30 inodes
> -root 3 20 20 00 [--------]
>  fsgqa 30 40 40 00 [--------]
>  
>  === group quota test ===
>  group blocks and inode limit
> -root 0 20480 20480 00 [--------] 3 20 20 00 [--------]
>  fsgqa 0 40960 40960 00 [--------] 0 40 40 00 [--------]
>  
>  wrote 31457280/31457280 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  group blocks quota after write 30M data
> -root 0 20480 20480 00 [--------]
>  fsgqa 30720 40960 40960 00 [--------]
>  
>  group inode quota after creating 30 inodes
> -root 3 20 20 00 [--------]
>  fsgqa 30 40 40 00 [--------]
>  
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-09-22 18:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20 22:14 [PATCH 0/3] move xfs non-project quota tests to generic Eric Sandeen
2016-09-20 22:15 ` [PATCH 1/3] xfs/260: fix output to match actions Eric Sandeen
2016-09-22 14:07   ` Bill O'Donnell
2016-09-20 22:21 ` [PATCH 2/3] modify xfs/ quota tests to work on generic filesystems Eric Sandeen
2016-09-21  9:37   ` Eryu Guan
2016-09-21 13:02     ` Eric Sandeen
2016-09-21 14:30       ` Eryu Guan
2016-09-21 14:52         ` Eric Sandeen
2016-09-22 14:09   ` Bill O'Donnell
2016-09-22 18:54   ` [PATCH 2/3 V2] " Eric Sandeen
2016-09-22 18:57     ` Bill O'Donnell
2016-09-20 22:24 ` [PATCH 3/3] move now-generic quota tests to generic Eric Sandeen
2016-09-20 23:40   ` Dave Chinner
2016-09-21  1:41     ` Eric Sandeen
2016-09-21  6:44     ` Eryu Guan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.