linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: guaneryu@gmail.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me,
	Christoph Hellwig <hch@infradead.org>
Subject: [PATCH 6/4] xfs/007: fix regressions on V4 filesystems
Date: Wed, 28 Jul 2021 13:00:45 -0700	[thread overview]
Message-ID: <20210728200045.GB3601425@magnolia> (raw)
In-Reply-To: <162743097757.3427426.8734776553736535870.stgit@magnolia>

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

Following commit eae40404, I noticed the following regression when
running a V4 fstests run on an 5.13 kernel:

--- /tmp/fstests/tests/xfs/007.out      2021-05-13 11:47:55.793859995 -0700
+++ /var/tmp/fstests/xfs/007.out.bad    2021-07-28 09:23:42.856000000 -0700
@@ -16,4 +16,4 @@
 *** umount
 *** Usage after quotarm ***
 core.nblocks = 0
-core.nblocks = 0
+core.nblocks = 1

The underlying cause of this problem is the fact that we now remount the
filesystem with no quota options because that will (soon) become the
only means to turn off quota accounting on XFS.  Because V4 filesystems
don't support simultaneous project and group quotas and play weird
remapping games with the incore superblock field, we actually have to
issue a remove command for the group quota file if we're trying to
truncate the project quota file on a V4 filesystem.

Due to stupid limitations in xfs_quota we actually have to issue a
separate 'remove' command.

Fixes: eae40404 ("xfs/007: unmount after disabling quota")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/007 |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/tests/xfs/007 b/tests/xfs/007
index 796db960..6d6d828b 100755
--- a/tests/xfs/007
+++ b/tests/xfs/007
@@ -43,10 +43,27 @@ do_test()
 	_qmount
 	echo "*** turn off $off_opts quotas"
 	$XFS_QUOTA_PROG -x -c "off -$off_opts" $SCRATCH_MNT
+
+	# Remount the filesystem with no quota options to force quotas off.
+	# This takes care of newer kernels where quotaoff clears the superblock
+	# quota enforcement flags but doesn't shut down accounting.
 	_scratch_unmount
 	_qmount_option ""
 	_scratch_mount
-	$XFS_QUOTA_PROG -x -c "remove -$off_opts" $SCRATCH_MNT
+
+	rm_commands=(-x -c "remove -$off_opts")
+
+	# Remounting a V4 fs with no quota options means that the internal
+	# gquotino -> pquotino remapping does not happen.  If we want to
+	# truncate the "project" quota file we must run remove -g.  However,
+	# xfs_quota has a nasty sharp edge wherein passing '-g' and '-p' only
+	# results in a QUOTARM call for the group quota file, so we must make
+	# a separate remove call.
+	[ $_fs_has_crcs == 0 ] && [ "$off_opts" = "up" ] && \
+		rm_commands+=(-c "remove -g")
+
+	$XFS_QUOTA_PROG "${rm_commands[@]}" $SCRATCH_MNT
+
 	echo "*** umount"
 	_scratch_unmount
 

  parent reply	other threads:[~2021-07-28 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  0:09 [PATCHSET 0/4] fstests: random fixes Darrick J. Wong
2021-07-28  0:09 ` [PATCH 1/4] xfs/106: fix golden output regression in quota off test Darrick J. Wong
2021-07-28  0:09 ` [PATCH 2/4] check: don't leave the scratch filesystem mounted after _notrun Darrick J. Wong
2021-08-01 13:02   ` Eryu Guan
2021-08-02 22:13     ` Darrick J. Wong
2021-07-28  0:09 ` [PATCH 3/4] generic/570: fix regression when SCRATCH_DEV is still formatted Darrick J. Wong
2021-08-01 13:08   ` Eryu Guan
2021-08-02 22:15     ` Darrick J. Wong
2021-07-28  0:09 ` [PATCH 4/4] check: back off the OOM score adjustment to -500 Darrick J. Wong
2021-07-28 20:00 ` [PATCH 5/4] xfs/530: skip test if user MKFS_OPTIONS screw up formatting Darrick J. Wong
2021-07-28 20:00 ` Darrick J. Wong [this message]
2021-08-01 13:18 ` [PATCHSET 0/4] fstests: random fixes Eryu Guan

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=20210728200045.GB3601425@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).