diff mbox series

[3/5] xfs/439: amend test to work with new log geometry validation

Message ID 168840383001.1317961.12926483978316384291.stgit@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes for v2023.06.18 | expand

Commit Message

Darrick J. Wong July 3, 2023, 5:03 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

An upcoming patch moves more log validation checks to the superblock
verifier, so update this test as needed.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/439 |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Zorro Lang July 5, 2023, 6:37 a.m. UTC | #1
On Mon, Jul 03, 2023 at 10:03:50AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> An upcoming patch moves more log validation checks to the superblock
> verifier, so update this test as needed.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/439 |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/tests/xfs/439 b/tests/xfs/439
> index b7929493d1..8c69ece655 100755
> --- a/tests/xfs/439
> +++ b/tests/xfs/439
> @@ -21,7 +21,9 @@ _begin_fstest auto quick fuzzers log
>  _supported_fs xfs
>  _require_scratch_nocheck
>  # We corrupt XFS on purpose, and check if assert failures would crash system.
> -_require_no_xfs_bug_on_assert
> +# This used to be _require_no_xfs_bug_on_assert, but now we've fixed the sb
> +# verifier to reject this before xfs_log_mount gets to it:
> +_fixed_by_kernel_commit XXXXXXXXXXXX "xfs: journal geometry is not properly bounds checked"

This case is a regression test case for:
  9c92ee2 ("xfs: validate sb_logsunit is a multiple of the fs blocksize")

So I think it's better to write this major commit at first, before recording the
secondary one.

>  
>  rm -f "$seqres.full"
>  
> @@ -33,7 +35,7 @@ blksz=$(_scratch_xfs_get_sb_field blocksize)
>  _scratch_xfs_set_sb_field logsunit $((blksz - 1)) >> $seqres.full 2>&1
>  
>  # Check if logsunit is set correctly
> -lsunit=$(_scratch_xfs_get_sb_field logsunit)
> +lsunit=$(_scratch_xfs_get_sb_field logsunit 2>/dev/null)

What kind of error should be ignored at here?

>  [ $lsunit -ne $((blksz - 1)) ] && _notrun "failed to set sb_logsunit"
>  
>  # Mount and writing log may trigger a crash on buggy kernel
>
Darrick J. Wong July 5, 2023, 3:37 p.m. UTC | #2
On Wed, Jul 05, 2023 at 02:37:09PM +0800, Zorro Lang wrote:
> On Mon, Jul 03, 2023 at 10:03:50AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > An upcoming patch moves more log validation checks to the superblock
> > verifier, so update this test as needed.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/439 |    6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/tests/xfs/439 b/tests/xfs/439
> > index b7929493d1..8c69ece655 100755
> > --- a/tests/xfs/439
> > +++ b/tests/xfs/439
> > @@ -21,7 +21,9 @@ _begin_fstest auto quick fuzzers log
> >  _supported_fs xfs
> >  _require_scratch_nocheck
> >  # We corrupt XFS on purpose, and check if assert failures would crash system.
> > -_require_no_xfs_bug_on_assert
> > +# This used to be _require_no_xfs_bug_on_assert, but now we've fixed the sb
> > +# verifier to reject this before xfs_log_mount gets to it:
> > +_fixed_by_kernel_commit XXXXXXXXXXXX "xfs: journal geometry is not properly bounds checked"
> 
> This case is a regression test case for:
>   9c92ee2 ("xfs: validate sb_logsunit is a multiple of the fs blocksize")
> 
> So I think it's better to write this major commit at first, before recording the
> secondary one.

Ok.  I guess that's a result of this test predating _fixed_by.

Also I'll update this with the real kernel commit id, now that there is
one.

> >  
> >  rm -f "$seqres.full"
> >  
> > @@ -33,7 +35,7 @@ blksz=$(_scratch_xfs_get_sb_field blocksize)
> >  _scratch_xfs_set_sb_field logsunit $((blksz - 1)) >> $seqres.full 2>&1
> >  
> >  # Check if logsunit is set correctly
> > -lsunit=$(_scratch_xfs_get_sb_field logsunit)
> > +lsunit=$(_scratch_xfs_get_sb_field logsunit 2>/dev/null)
> 
> What kind of error should be ignored at here?

The same new logsunit validation code, when ported to userspace, causes
xfs_db to emit verifier complaints that disturb the golden output.

--D

> 
> >  [ $lsunit -ne $((blksz - 1)) ] && _notrun "failed to set sb_logsunit"
> >  
> >  # Mount and writing log may trigger a crash on buggy kernel
> > 
>
diff mbox series

Patch

diff --git a/tests/xfs/439 b/tests/xfs/439
index b7929493d1..8c69ece655 100755
--- a/tests/xfs/439
+++ b/tests/xfs/439
@@ -21,7 +21,9 @@  _begin_fstest auto quick fuzzers log
 _supported_fs xfs
 _require_scratch_nocheck
 # We corrupt XFS on purpose, and check if assert failures would crash system.
-_require_no_xfs_bug_on_assert
+# This used to be _require_no_xfs_bug_on_assert, but now we've fixed the sb
+# verifier to reject this before xfs_log_mount gets to it:
+_fixed_by_kernel_commit XXXXXXXXXXXX "xfs: journal geometry is not properly bounds checked"
 
 rm -f "$seqres.full"
 
@@ -33,7 +35,7 @@  blksz=$(_scratch_xfs_get_sb_field blocksize)
 _scratch_xfs_set_sb_field logsunit $((blksz - 1)) >> $seqres.full 2>&1
 
 # Check if logsunit is set correctly
-lsunit=$(_scratch_xfs_get_sb_field logsunit)
+lsunit=$(_scratch_xfs_get_sb_field logsunit 2>/dev/null)
 [ $lsunit -ne $((blksz - 1)) ] && _notrun "failed to set sb_logsunit"
 
 # Mount and writing log may trigger a crash on buggy kernel