xfs: test a regression in dquot type checking
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 Feb 2021 19:41:58 +0000 (11:41 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 7 Feb 2021 15:17:46 +0000 (23:17 +0800)
This is a regression test for incorrect ondisk dquot type checking that
was introduced in Linux 5.9.  The bug is that we can no longer switch a
V4 filesystem from having group quotas to having project quotas (or vice
versa) without logging corruption errors.  That is a valid use case, so
add a regression test to ensure this can be done.

[Eryu: add _require_check_dmesg and print the 'corruption' dmesg]

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/527 [new file with mode: 0755]
tests/xfs/527.out [new file with mode: 0644]
tests/xfs/group

diff --git a/tests/xfs/527 b/tests/xfs/527
new file mode 100755 (executable)
index 0000000..f612e7a
--- /dev/null
@@ -0,0 +1,63 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 527
+#
+# Regression test for incorrect validation of ondisk dquot type flags when
+# we're switching between group and project quotas while mounting a V4
+# filesystem.  This test doesn't actually force the creation of a V4 fs because
+# even V5 filesystems ought to be able to switch between the two without
+# triggering corruption errors.
+#
+# The appropriate XFS patch is:
+# xfs: fix incorrect root dquot corruption error when switching group/project
+# quota types
+
+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/quota
+
+# real QA test starts here
+_supported_fs xfs
+_require_xfs_debug
+_require_quota
+_require_scratch
+_require_check_dmesg
+
+rm -f $seqres.full
+
+echo "Format filesystem" | tee -a $seqres.full
+_scratch_mkfs > $seqres.full
+
+echo "Mount with project quota" | tee -a $seqres.full
+_qmount_option 'prjquota'
+_qmount
+_require_prjquota $SCRATCH_DEV
+
+echo "Mount with group quota" | tee -a $seqres.full
+_qmount_option 'grpquota'
+_qmount
+$here/src/feature -G $SCRATCH_DEV || echo "group quota didn't mount?"
+
+echo "Check dmesg for corruption"
+_dmesg_since_test_start | grep corruption
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/527.out b/tests/xfs/527.out
new file mode 100644 (file)
index 0000000..5112f3c
--- /dev/null
@@ -0,0 +1,5 @@
+QA output created by 527
+Format filesystem
+Mount with project quota
+Mount with group quota
+Check dmesg for corruption
index 9e78036..e861cec 100644 (file)
 524 auto quick mkfs
 525 auto quick mkfs
 526 auto quick mkfs
+527 auto quick quota