fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] fstests: random fixes
@ 2020-04-23 23:31 Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 1/5] generic/590: fix the xfs feature detection logic Darrick J. Wong
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

Here are a few random fixes that have become necessary for linux 5.7.
Also included are various minor fixes that have been accumulating for
some time.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=random-fixes

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=random-fixes

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=random-fixes

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] generic/590: fix the xfs feature detection logic
  2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong
@ 2020-04-23 23:31 ` Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 2/5] xfs/126: make sure we corrupt the attr leaf in a detectable way Darrick J. Wong
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

The setup code in this regression test case tries to figure out if
certain features known to be incompatible with realtime are known to
mkfs, and if so, to forcibly disable them.

Unfortunately, the reflink feature detection logic here is broken,
because we have no way of distinguishing between the helper function
_scratch_mkfs_xfs_supported returning nonzero because reflink isn't
compatible with mkfs's defaults (e.g. your mkfs has rmapbt=1 by default)
vs. reflink isn't recognized at all vs. something else broke.

However, we can grep the mkfs output to look for reflink support, and if
we find it then we disable it.  That's fine for this test, since on XFS
it's trying to set up the exact conditions to test a known bug.

Second, rmapbt isn't currently compatible with realtime either, so we
need to detect and mask that off too.

Third, the test only needs to perform this feature detection if the test
runner didn't set SCRATCH_RTDEV, because we require that if the runner
configured SCRATCH_RTDEV, they also set MKFS_OPTIONS appropriately.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/590 |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)


diff --git a/tests/generic/590 b/tests/generic/590
index 45f443c3..284bd49d 100755
--- a/tests/generic/590
+++ b/tests/generic/590
@@ -41,6 +41,21 @@ bs=4096
 rextsize=4
 filesz=$(((maxextlen + 1) * bs))
 
+must_disable_feature() {
+	local feat="$1"
+
+	# If mkfs doesn't know about the feature, we don't need to disable it
+	$MKFS_XFS_PROG --help 2>&1 | grep -q "${feat}=0" || return 1
+
+	# If turning the feature on works, we don't need to disable it
+	_scratch_mkfs_xfs_supported -m "${feat}=1" "${disabled_features[@]}" \
+		> /dev/null 2>&1 && return 1
+
+	# Otherwise mkfs knows of the feature and formatting with it failed,
+	# so we do need to mask it.
+	return 0
+}
+
 extra_options=""
 # If we're testing XFS, set up the realtime device to reproduce the bug.
 if [[ $FSTYP = xfs ]]; then
@@ -54,14 +69,20 @@ if [[ $FSTYP = xfs ]]; then
 		loop="$(_create_loop_device "$TEST_DIR/$seq")"
 		USE_EXTERNAL=yes
 		SCRATCH_RTDEV="$loop"
+		disabled_features=()
+
+		# disable reflink if not supported by realtime devices
+		must_disable_feature reflink &&
+			disabled_features=(-m reflink=0)
+
+		# disable rmap if not supported by realtime devices
+		must_disable_feature rmapbt &&
+			disabled_features+=(-m rmapbt=0)
 	fi
 	extra_options="$extra_options -r extsize=$((bs * rextsize))"
 	extra_options="$extra_options -d agsize=$(((maxextlen + 1) * bs / 2)),rtinherit=1"
-	# disable reflink as reflink not supported with realtime devices
-	if _scratch_mkfs_xfs_supported -m reflink=0 >/dev/null 2>&1; then
-		extra_options="$extra_options -m reflink=0"
-	fi
-	_scratch_mkfs $extra_options >>$seqres.full 2>&1
+
+	_scratch_mkfs $extra_options "${disabled_features[@]}" >>$seqres.full 2>&1
 	_try_scratch_mount >>$seqres.full 2>&1 || \
 		_notrun "mount failed, kernel doesn't support realtime?"
 	_scratch_unmount


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] xfs/126: make sure we corrupt the attr leaf in a detectable way
  2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 1/5] generic/590: fix the xfs feature detection logic Darrick J. Wong
@ 2020-04-23 23:31 ` Darrick J. Wong
  2020-04-27 17:58   ` Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 3/5] generic/570: don't run this test on systems supporting userspace hibernate Darrick J. Wong
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Try harder to fuzz the attr leaf so this consistently trips a verifier.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/126 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/tests/xfs/126 b/tests/xfs/126
index 4f9f8cf9..0d497779 100755
--- a/tests/xfs/126
+++ b/tests/xfs/126
@@ -72,7 +72,7 @@ echo "+ corrupt xattr"
 loff=1
 while true; do
 	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" | grep -q 'file attr block is unmapped' && break
-	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
+	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 4096 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 	loff="$((loff + 1))"
 done
 


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] generic/570: don't run this test on systems supporting userspace hibernate
  2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 1/5] generic/590: fix the xfs feature detection logic Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 2/5] xfs/126: make sure we corrupt the attr leaf in a detectable way Darrick J. Wong
@ 2020-04-23 23:31 ` Darrick J. Wong
  2020-04-24  6:22   ` Christoph Hellwig
  2020-04-23 23:31 ` [PATCH 4/5] xfs/30[78]: fix regressions due to strengthened AGF checks Darrick J. Wong
  2020-04-23 23:31 ` [PATCH 5/5] xfs/122: fix for linux 5.7 stuff Darrick J. Wong
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

It turns out that userspace actually does need the ability to write to
an active swapfile if userspace hibernation (uswsusp) is enabled.
Therefore, this test doesn't apply under those conditions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/570 |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/generic/570 b/tests/generic/570
index d574f4b7..e5da2381 100755
--- a/tests/generic/570
+++ b/tests/generic/570
@@ -32,6 +32,7 @@ _supported_fs generic
 _require_test_program swapon
 _require_scratch_nocheck
 _require_block_device $SCRATCH_DEV
+test -e /dev/snapshot && _notrun "userspace hibernation to swap is enabled"
 
 rm -f $seqres.full
 


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] xfs/30[78]: fix regressions due to strengthened AGF checks
  2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong
                   ` (2 preceding siblings ...)
  2020-04-23 23:31 ` [PATCH 3/5] generic/570: don't run this test on systems supporting userspace hibernate Darrick J. Wong
@ 2020-04-23 23:31 ` Darrick J. Wong
  2020-04-24 10:30   ` Christoph Hellwig
  2020-04-23 23:31 ` [PATCH 5/5] xfs/122: fix for linux 5.7 stuff Darrick J. Wong
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Reorder the order in which we tweak AGF fields to avoid falling afoul of
the new AGF sanity checks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/307 |    2 +-
 tests/xfs/308 |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/tests/xfs/307 b/tests/xfs/307
index 705643da..2f517952 100755
--- a/tests/xfs/307
+++ b/tests/xfs/307
@@ -115,8 +115,8 @@ debris_bno=$((bno + len - debris_len))
 echo "Remove the extent from the freesp btrees"
 _set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr bnoroot'
 _set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr cntroot'
-_set_agf_data freeblks $((agf_freeblks - debris_len))
 _set_agf_data longest $((len - debris_len))
+_set_agf_data freeblks $((agf_freeblks - debris_len))
 _set_sb_data fdblocks $((sb_fdblocks - debris_len))
 
 echo "Add the extent to the refcount btree"
diff --git a/tests/xfs/308 b/tests/xfs/308
index f809b499..569a25f1 100755
--- a/tests/xfs/308
+++ b/tests/xfs/308
@@ -115,8 +115,8 @@ debris_bno=$((bno + len - debris_len))
 echo "Remove the extent from the freesp btrees"
 _set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr bnoroot'
 _set_agf_data "recs[1].blockcount" $((len - debris_len)) -c 'addr cntroot'
-_set_agf_data freeblks $((agf_freeblks - debris_len))
 _set_agf_data longest $((len - debris_len))
+_set_agf_data freeblks $((agf_freeblks - debris_len))
 _set_sb_data fdblocks $((sb_fdblocks - debris_len))
 
 echo "Add the extent to the refcount btree"


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] xfs/122: fix for linux 5.7 stuff
  2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong
                   ` (3 preceding siblings ...)
  2020-04-23 23:31 ` [PATCH 4/5] xfs/30[78]: fix regressions due to strengthened AGF checks Darrick J. Wong
@ 2020-04-23 23:31 ` Darrick J. Wong
  2020-04-24  6:23   ` Christoph Hellwig
  4 siblings, 1 reply; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-23 23:31 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Fix some regressions on xfsprogs 5.7.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/122     |    2 ++
 tests/xfs/122.out |    1 +
 2 files changed, 3 insertions(+)


diff --git a/tests/xfs/122 b/tests/xfs/122
index 64b63cb1..dbf3a22b 100755
--- a/tests/xfs/122
+++ b/tests/xfs/122
@@ -181,6 +181,8 @@ xfs_fsop_getparents_handlereq_t
 xfs_dinode_core_t
 struct xfs_iext_cursor
 struct xfs_ino_geometry
+struct xfs_attrlist
+struct xfs_attrlist_ent
 EOF
 
 echo 'int main(int argc, char *argv[]) {' >>$cprog
diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index 91a3bdae..45c42e59 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -58,6 +58,7 @@ offsetof(xfs_sb_t, sb_width) = 188
 sizeof(struct xfs_acl) = 4
 sizeof(struct xfs_acl_entry) = 12
 sizeof(struct xfs_ag_geometry) = 128
+sizeof(struct xfs_agfl) = 36
 sizeof(struct xfs_attr3_leaf_hdr) = 80
 sizeof(struct xfs_attr3_leafblock) = 88
 sizeof(struct xfs_attr3_rmt_hdr) = 56


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] generic/570: don't run this test on systems supporting userspace hibernate
  2020-04-23 23:31 ` [PATCH 3/5] generic/570: don't run this test on systems supporting userspace hibernate Darrick J. Wong
@ 2020-04-24  6:22   ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2020-04-24  6:22 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests

On Thu, Apr 23, 2020 at 04:31:30PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> It turns out that userspace actually does need the ability to write to
> an active swapfile if userspace hibernation (uswsusp) is enabled.
> Therefore, this test doesn't apply under those conditions.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good and fixes the spurious failures I'm seeing:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/5] xfs/122: fix for linux 5.7 stuff
  2020-04-23 23:31 ` [PATCH 5/5] xfs/122: fix for linux 5.7 stuff Darrick J. Wong
@ 2020-04-24  6:23   ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2020-04-24  6:23 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests

On Thu, Apr 23, 2020 at 04:31:42PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Fix some regressions on xfsprogs 5.7.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good.  I actually had the same changes locally but forgot to send
them out:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] xfs/30[78]: fix regressions due to strengthened AGF checks
  2020-04-23 23:31 ` [PATCH 4/5] xfs/30[78]: fix regressions due to strengthened AGF checks Darrick J. Wong
@ 2020-04-24 10:30   ` Christoph Hellwig
  0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2020-04-24 10:30 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests

On Thu, Apr 23, 2020 at 04:31:36PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Reorder the order in which we tweak AGF fields to avoid falling afoul of
> the new AGF sanity checks.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/5] xfs/126: make sure we corrupt the attr leaf in a detectable way
  2020-04-23 23:31 ` [PATCH 2/5] xfs/126: make sure we corrupt the attr leaf in a detectable way Darrick J. Wong
@ 2020-04-27 17:58   ` Darrick J. Wong
  0 siblings, 0 replies; 10+ messages in thread
From: Darrick J. Wong @ 2020-04-27 17:58 UTC (permalink / raw)
  To: guaneryu; +Cc: linux-xfs, fstests

On Thu, Apr 23, 2020 at 04:31:24PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Try harder to fuzz the attr leaf so this consistently trips a verifier.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

DOH, NAK on this one, you might as well take "xfs/126: make blocktrash
work reliably on attrleaf blocks" from Anthony Iliopoulos.

--D

> ---
>  tests/xfs/126 |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> diff --git a/tests/xfs/126 b/tests/xfs/126
> index 4f9f8cf9..0d497779 100755
> --- a/tests/xfs/126
> +++ b/tests/xfs/126
> @@ -72,7 +72,7 @@ echo "+ corrupt xattr"
>  loff=1
>  while true; do
>  	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" | grep -q 'file attr block is unmapped' && break
> -	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
> +	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 4096 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
>  	loff="$((loff + 1))"
>  done
>  
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-04-27 17:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 23:31 [PATCH 0/5] fstests: random fixes Darrick J. Wong
2020-04-23 23:31 ` [PATCH 1/5] generic/590: fix the xfs feature detection logic Darrick J. Wong
2020-04-23 23:31 ` [PATCH 2/5] xfs/126: make sure we corrupt the attr leaf in a detectable way Darrick J. Wong
2020-04-27 17:58   ` Darrick J. Wong
2020-04-23 23:31 ` [PATCH 3/5] generic/570: don't run this test on systems supporting userspace hibernate Darrick J. Wong
2020-04-24  6:22   ` Christoph Hellwig
2020-04-23 23:31 ` [PATCH 4/5] xfs/30[78]: fix regressions due to strengthened AGF checks Darrick J. Wong
2020-04-24 10:30   ` Christoph Hellwig
2020-04-23 23:31 ` [PATCH 5/5] xfs/122: fix for linux 5.7 stuff Darrick J. Wong
2020-04-24  6:23   ` Christoph Hellwig

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