xfs: test statfs on project quota directory
authorZorro Lang <zlang@redhat.com>
Sun, 28 Jul 2019 09:07:15 +0000 (17:07 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 4 Aug 2019 09:03:04 +0000 (17:03 +0800)
There's a bug on xfs cause statfs get negative f_ffree value from
a project quota directory. It's fixed by "de7243057 fs/xfs: fix
f_ffree value for statfs when project quota is set". So add statfs
testing on project quota block and inode count limit.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/511 [new file with mode: 0755]
tests/xfs/511.out [new file with mode: 0644]
tests/xfs/group

diff --git a/tests/xfs/511 b/tests/xfs/511
new file mode 100755 (executable)
index 0000000..972dc8d
--- /dev/null
@@ -0,0 +1,61 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 511
+#
+# Test statfs when project quota is set.
+# Uncover de7243057 fs/xfs: fix f_ffree value for statfs when project quota is set
+#
+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 /
+       _scratch_unmount
+       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 xfs
+_supported_os Linux
+_require_scratch
+_require_xfs_quota
+
+_scratch_mkfs >/dev/null 2>&1
+_scratch_enable_pquota
+_qmount_option "prjquota"
+_qmount
+_require_prjquota $SCRATCH_DEV
+
+# Create a directory to be project object, and create a file to take 64k space
+mkdir $SCRATCH_MNT/t
+$XFS_IO_PROG -f -c "pwrite 0 65536" -c sync $SCRATCH_MNT/t/file >>$seqres.full
+
+quota_cmd="$XFS_QUOTA_PROG -x"
+$quota_cmd -c "project -s -p $SCRATCH_MNT/t 42" $SCRATCH_MNT >/dev/null 2>&1
+$quota_cmd -c 'limit -p isoft=53 bsoft=100m 42' $SCRATCH_MNT
+
+# The itotal and size should be 53 and 102400(k), as above project quota limit.
+# The isued and used should be 2 and 64(k), as this case takes.
+df -k --output=file,itotal,iused,size,used $SCRATCH_MNT/t | \
+       _filter_scratch | _filter_spaces
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/511.out b/tests/xfs/511.out
new file mode 100644 (file)
index 0000000..d360901
--- /dev/null
@@ -0,0 +1,3 @@
+QA output created by 511
+File Inodes IUsed 1K-blocks Used
+SCRATCH_MNT/t 53 2 102400 64
index d493298b0b06e7eb888f36c3e72fde286d0611c2..a7ad300e4ea1601f00abc7d9729f61635d2eb399 100644 (file)
 508 auto quick quota
 509 auto ioctl
 510 auto ioctl quick
+511 auto quick quota