Skip to content

Commit

Permalink
xfs: test xfs_quota "state" command
Browse files Browse the repository at this point in the history
This exercises the xfs_quota "state" command for every
combination of user, group, and project quota enablement
on both crc (with project quota inode on disk) and non-crc
(where project quota overlaps group quota on disk) filesystems.

It currently requires patches to the upstream kernel
("quota: fill in Q_XGETQSTAT inode information for inactive quotas")
and to xfsprogs ("xfs_quota: wire up XFS_GETQSTATV") to pass.

Rather than trying to make it run on older kernels without
crc capability, I restrict the test to crc-capable environments,
but test with and without crcs enabled (and hence with and without
project quota inode on disk).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
  • Loading branch information
sandeen authored and Eryu Guan committed Aug 26, 2016
1 parent 478b969 commit 397c6eb
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 0 deletions.
97 changes: 97 additions & 0 deletions tests/xfs/263
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#! /bin/bash
# FS QA Test 263
#
# test xfs_quota state command
#
#-----------------------------------------------------------------------
# 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

# Modify as appropriate.
_supported_fs xfs
_supported_os Linux

_require_scratch
_require_xfs_quota

# We could test older, non-project capable kernels but keep it simpler;
# Only test crc and beyond (but we will test with and without the feature)
_require_xfs_mkfs_crc
_require_xfs_crc

rm -f $seqres.full

function option_string()
{
VAL=$1
# Treat 3 options as a bit field, prjquota|grpquota|usrquota
OPT="rw"
if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi;
if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi;
if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi;
echo $OPT
}

function test_all_state()
{
for I in `seq 0 7`; do
OPTIONS=`option_string $I`
echo "== Options: $OPTIONS =="
# Some combinations won't mount on V4 supers (grp + prj)
_qmount_option "$OPTIONS"
_scratch_mount &>> $seqres.full || continue
$XFS_QUOTA_PROG -x -c "state" $SCRATCH_MNT | _filter_scratch
_scratch_unmount
done
}

echo "==== NO CRC ===="
# Control size to control inode numbers
$MKFS_XFS_PROG -f -m crc=0 -n ftype=0 -d size=512m $SCRATCH_DEV >>$seqres.full
test_all_state

echo "==== CRC ===="
$MKFS_XFS_PROG -f -m crc=1 -d size=512m $SCRATCH_DEV >>$seqres.full
test_all_state

status=0
exit
199 changes: 199 additions & 0 deletions tests/xfs/263.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
QA output created by 263
==== NO CRC ====
== Options: rw ==
== Options: usrquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #131 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: grpquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #131 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #132 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: usrquota,grpquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #131 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #132 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: prjquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #131 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #132 (1 blocks, 1 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: usrquota,prjquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #131 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #132 (1 blocks, 1 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: grpquota,prjquota,rw ==
== Options: usrquota,grpquota,prjquota,rw ==
==== CRC ====
== Options: rw ==
== Options: usrquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: grpquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #100 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: usrquota,grpquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #100 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: N/A
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: prjquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #100 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #101 (1 blocks, 1 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: usrquota,prjquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #100 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #101 (1 blocks, 1 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: grpquota,prjquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: OFF
Enforcement: OFF
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #100 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #101 (1 blocks, 1 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
== Options: usrquota,grpquota,prjquota,rw ==
User quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #99 (1 blocks, 1 extents)
Group quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #100 (1 blocks, 1 extents)
Project quota state on SCRATCH_MNT (SCRATCH_DEV)
Accounting: ON
Enforcement: ON
Inode: #101 (1 blocks, 1 extents)
Blocks grace time: [7 days]
Inodes grace time: [7 days]
Realtime Blocks grace time: [7 days]
1 change: 1 addition & 0 deletions tests/xfs/group
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
260 auto quick quota
261 auto quick quota
262 auto quick quota
263 auto quick quota
265 auto clone
266 dump ioctl auto quick
267 dump ioctl tape
Expand Down

0 comments on commit 397c6eb

Please sign in to comment.