public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: xfs <linux-xfs@vger.kernel.org>, fstests <fstests@vger.kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Chandan Babu R <chandanrlinux@gmail.com>,
	Brian Foster <bfoster@redhat.com>
Subject: [PATCH] xfs: test a regression in dquot type checking
Date: Tue, 2 Feb 2021 11:41:58 -0800	[thread overview]
Message-ID: <20210202194158.GR7193@magnolia> (raw)

From: Darrick J. Wong <djwong@kernel.org>

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.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/766     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/766.out |    5 ++++
 tests/xfs/group   |    1 +
 3 files changed, 69 insertions(+)
 create mode 100755 tests/xfs/766
 create mode 100644 tests/xfs/766.out

diff --git a/tests/xfs/766 b/tests/xfs/766
new file mode 100755
index 00000000..55bc03af
--- /dev/null
+++ b/tests/xfs/766
@@ -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. 766
+#
+# 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
+
+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"
+_check_dmesg_for corruption && \
+	echo "should not have seen corruption messages"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/766.out b/tests/xfs/766.out
new file mode 100644
index 00000000..18bd99f0
--- /dev/null
+++ b/tests/xfs/766.out
@@ -0,0 +1,5 @@
+QA output created by 766
+Format filesystem
+Mount with project quota
+Mount with group quota
+Check dmesg for corruption
diff --git a/tests/xfs/group b/tests/xfs/group
index fb78b0d7..cdca04b5 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -545,6 +545,7 @@
 763 auto quick rw realtime
 764 auto quick repair
 765 auto quick quota
+766 auto quick quota
 908 auto quick bigtime
 909 auto quick bigtime quota
 910 auto quick inobtcount

             reply	other threads:[~2021-02-02 19:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 19:41 Darrick J. Wong [this message]
2021-02-03 16:10 ` [PATCH] xfs: test a regression in dquot type checking Brian Foster
2021-02-04  4:14 ` Zorro Lang
2021-02-04  9:37 ` Chandan Babu R
2021-02-07 15:14 ` Eryu Guan
2021-02-08 16:50   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210202194158.GR7193@magnolia \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=chandanrlinux@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox