archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <>
Subject: [PATCH 5/4] xfs/530: skip test if user MKFS_OPTIONS screw up formatting
Date: Wed, 28 Jul 2021 13:00:20 -0700	[thread overview]
Message-ID: <20210728200020.GA3601425@magnolia> (raw)
In-Reply-To: <162743097757.3427426.8734776553736535870.stgit@magnolia>

From: Darrick J. Wong <>

Skip this test if the user's MKFS_OPTIONS are not compatible with the
realtime parameters that we're injecting in order to test growfs bugs.
Because this test is trying to trigger a specific kernel bug, we need
mkfs to format a filesystem with very specific geometry parameters.

The first problem stems from the fact that the test performs a default
mkfs, computes a suitable realtime geometry from that filesystem, and
then formats a second time with an explicit blocksize option to mkfs.
If the original MKFS_OPTS contained a blocksize directive, the mkfs will
fail because the option was respecified.  The two blocksize options will
be the same, so we drop the explicit blocksize option.

However, this exposes a second problem: MKFS_OPTIONS might contain
options that are not compatible with any realtime filesystem.  If that
happens, _scratch_do_mkfs will "helpfully" drop MKFS_OPTIONS and try
again with only the options specified by the test.  This gets us a
filesystem with the given rt geometry, but it could be missing critical
parameters from MKFS_OPTIONS (like blocksize).  The test will then fail
to exercise the growfs bugfix, so the second part of the fix is to check
that the filesystem we're going to test actually has the geometry
parameters that we require.

Signed-off-by: Darrick J. Wong <>
Reviewed-by: Chandan Babu R <>
 tests/xfs/530 |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/xfs/530 b/tests/xfs/530
index 99a4d33b..0e12422d 100755
--- a/tests/xfs/530
+++ b/tests/xfs/530
@@ -60,10 +60,22 @@ echo "Format and mount rt volume"
 export USE_EXTERNAL=yes
 export SCRATCH_RTDEV=$rtdev
-_scratch_mkfs -d size=$((1024 * 1024 * 1024)) -b size=${dbsize} \
+_scratch_mkfs -d size=$((1024 * 1024 * 1024)) \
 	      -r size=${rtextsz},extsize=${rtextsz} >> $seqres.full
 _try_scratch_mount || _notrun "Couldn't mount fs with synthetic rt volume"
+# If we didn't get the desired realtime volume and the same blocksize as the
+# first format (which we used to compute a specific rt geometry), skip the
+# test.  This can happen if the MKFS_OPTIONS conflict with the ones we passed
+# to _scratch_mkfs or do not result in a valid rt fs geometry.  In this case,
+# _scratch_mkfs will try to "succeed" at formatting by dropping MKFS_OPTIONS,
+# giving us the wrong geometry.
+formatted_blksz="$(_get_block_size $SCRATCH_MNT)"
+test "$formatted_blksz" -ne "$dbsize" && \
+	_notrun "Tried to format with $dbsize blocksize, got $formatted_blksz."
+$XFS_INFO_PROG $SCRATCH_MNT | egrep -q 'realtime.*blocks=0' && \
+	_notrun "Filesystem should have a realtime volume"
 echo "Consume free space"
 nr_free_blks=$(stat -f -c '%f' $SCRATCH_MNT)

  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 ` Darrick J. Wong [this message]
2021-07-28 20:00 ` [PATCH 6/4] xfs/007: fix regressions on V4 filesystems Darrick J. Wong
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:

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

  git send-email \
    --in-reply-to=20210728200020.GA3601425@magnolia \ \ \ \ \ \ \

* 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).