From: Darrick J. Wong Date: Wed, 28 Jul 2021 20:00:20 +0000 (-0700) Subject: xfs/530: skip test if user MKFS_OPTIONS screw up formatting X-Git-Tag: v2022.05.01~308 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=4fdd27ce193ec2a388d0b7d0f5ea1067c3cc876d;hp=7446ce37eac47c5f68a1999c361335b5bd7edd4b xfs/530: skip test if user MKFS_OPTIONS screw up formatting 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 Signed-off-by: Eryu Guan --- diff --git a/tests/xfs/530 b/tests/xfs/530 index 4d168ac5..9c6f44d7 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" fillerdir=$SCRATCH_MNT/fillerdir nr_free_blks=$(stat -f -c '%f' $SCRATCH_MNT)