All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET 0/2] fstests: test xfsprogs regression fixed in 5.12
@ 2021-04-28  4:08 Darrick J. Wong
  2021-04-28  4:08 ` [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs Darrick J. Wong
  2021-04-28  4:08 ` [PATCH 2/2] xfs/010: filter out bad finobt levels complaint Darrick J. Wong
  0 siblings, 2 replies; 6+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:08 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

Hi all,

Here are new regression tests to exercise code that has been fixed as of
the upstream xfsprogs 5.12 release.

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

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=xfsprogs-regressions
---
 tests/xfs/010     |    1 +
 tests/xfs/757     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/757.out |    7 ++++++
 tests/xfs/group   |    1 +
 4 files changed, 72 insertions(+)
 create mode 100755 tests/xfs/757
 create mode 100644 tests/xfs/757.out


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

* [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs
  2021-04-28  4:08 [PATCHSET 0/2] fstests: test xfsprogs regression fixed in 5.12 Darrick J. Wong
@ 2021-04-28  4:08 ` Darrick J. Wong
  2021-04-28 17:38   ` Brian Foster
  2021-04-28  4:08 ` [PATCH 2/2] xfs/010: filter out bad finobt levels complaint Darrick J. Wong
  1 sibling, 1 reply; 6+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:08 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

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

Make sure that we can reset the root directory and the xattrs are erased
properly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/757     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/757.out |    7 ++++++
 tests/xfs/group   |    1 +
 3 files changed, 71 insertions(+)
 create mode 100755 tests/xfs/757
 create mode 100644 tests/xfs/757.out


diff --git a/tests/xfs/757 b/tests/xfs/757
new file mode 100755
index 00000000..0b9914f6
--- /dev/null
+++ b/tests/xfs/757
@@ -0,0 +1,63 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 757
+#
+# Make sure that attrs are handled properly when repair has to reset the root
+# directory.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/populate
+. ./common/fuzzy
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch_nocheck
+
+rm -f $seqres.full
+
+echo "Format and populate btree attr root dir"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
+__populate_create_attr "${SCRATCH_MNT}" "$((64 * blksz / 40))" true
+_scratch_unmount
+
+echo "Break the root directory"
+_scratch_xfs_fuzz_metadata_field core.mode zeroes 'sb 0' 'addr rootino' >> $seqres.full 2>&1
+
+echo "Detect bad root directory"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 && \
+	echo "Should have detected bad root dir"
+
+echo "Fix bad root directory"
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Detect fixed root directory"
+_scratch_xfs_repair -n >> $seqres.full 2>&1
+
+echo "Mount test"
+_scratch_mount
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/757.out b/tests/xfs/757.out
new file mode 100644
index 00000000..9f3aed5a
--- /dev/null
+++ b/tests/xfs/757.out
@@ -0,0 +1,7 @@
+QA output created by 757
+Format and populate btree attr root dir
+Break the root directory
+Detect bad root directory
+Fix bad root directory
+Detect fixed root directory
+Mount test
diff --git a/tests/xfs/group b/tests/xfs/group
index 731f869c..76e31167 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -528,5 +528,6 @@
 537 auto quick
 538 auto stress
 539 auto quick mount
+757 auto quick attr repair
 908 auto quick bigtime
 909 auto quick bigtime quota


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

* [PATCH 2/2] xfs/010: filter out bad finobt levels complaint
  2021-04-28  4:08 [PATCHSET 0/2] fstests: test xfsprogs regression fixed in 5.12 Darrick J. Wong
  2021-04-28  4:08 ` [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs Darrick J. Wong
@ 2021-04-28  4:08 ` Darrick J. Wong
  2021-04-28 17:38   ` Brian Foster
  1 sibling, 1 reply; 6+ messages in thread
From: Darrick J. Wong @ 2021-04-28  4:08 UTC (permalink / raw)
  To: djwong, guaneryu; +Cc: linux-xfs, fstests, guan

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

Since we're adding to xfs_repair the ability to warn about bad finobt
levels, filter that out.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/010 |    1 +
 1 file changed, 1 insertion(+)


diff --git a/tests/xfs/010 b/tests/xfs/010
index 95cc2555..a9394077 100755
--- a/tests/xfs/010
+++ b/tests/xfs/010
@@ -114,6 +114,7 @@ _corrupt_finobt_root $SCRATCH_DEV
 
 filter_finobt_repair() {
 	sed -e '/^agi has bad CRC/d' \
+	    -e '/^bad levels/d' \
 	    -e '/^bad finobt block/d' | \
 		_filter_repair_lostblocks
 }


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

* Re: [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs
  2021-04-28  4:08 ` [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs Darrick J. Wong
@ 2021-04-28 17:38   ` Brian Foster
  2021-04-29  0:31     ` Darrick J. Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Foster @ 2021-04-28 17:38 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests, guan

On Tue, Apr 27, 2021 at 09:08:43PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Make sure that we can reset the root directory and the xattrs are erased
> properly.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/757     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/757.out |    7 ++++++
>  tests/xfs/group   |    1 +
>  3 files changed, 71 insertions(+)
>  create mode 100755 tests/xfs/757
>  create mode 100644 tests/xfs/757.out
> 
> 
> diff --git a/tests/xfs/757 b/tests/xfs/757
> new file mode 100755
> index 00000000..0b9914f6
> --- /dev/null
> +++ b/tests/xfs/757
> @@ -0,0 +1,63 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test No. 757
> +#
> +# Make sure that attrs are handled properly when repair has to reset the root
> +# directory.
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 7 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -rf $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/populate
> +. ./common/fuzzy
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_require_scratch_nocheck
> +
> +rm -f $seqres.full
> +
> +echo "Format and populate btree attr root dir"
> +_scratch_mkfs > "$seqres.full" 2>&1
> +_scratch_mount
> +
> +blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
> +__populate_create_attr "${SCRATCH_MNT}" "$((64 * blksz / 40))" true
> +_scratch_unmount
> +
> +echo "Break the root directory"
> +_scratch_xfs_fuzz_metadata_field core.mode zeroes 'sb 0' 'addr rootino' >> $seqres.full 2>&1
> +
> +echo "Detect bad root directory"
> +_scratch_xfs_repair -n >> $seqres.full 2>&1 && \
> +	echo "Should have detected bad root dir"
> +
> +echo "Fix bad root directory"
> +_scratch_xfs_repair >> $seqres.full 2>&1
> +
> +echo "Detect fixed root directory"
> +_scratch_xfs_repair -n >> $seqres.full 2>&1
> +
> +echo "Mount test"
> +_scratch_mount
> +

Is the regression test here that attrs are erased after this sequence
(as suggested in the commit log), or that the fs mounts, or both? I'm
basically just wondering if we should also dump the xattrs on the root
dir as a last step (and expect NULL output)..? That aside:

Reviewed-by: Brian Foster <bfoster@redhat.com>

> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/757.out b/tests/xfs/757.out
> new file mode 100644
> index 00000000..9f3aed5a
> --- /dev/null
> +++ b/tests/xfs/757.out
> @@ -0,0 +1,7 @@
> +QA output created by 757
> +Format and populate btree attr root dir
> +Break the root directory
> +Detect bad root directory
> +Fix bad root directory
> +Detect fixed root directory
> +Mount test
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 731f869c..76e31167 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -528,5 +528,6 @@
>  537 auto quick
>  538 auto stress
>  539 auto quick mount
> +757 auto quick attr repair
>  908 auto quick bigtime
>  909 auto quick bigtime quota
> 


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

* Re: [PATCH 2/2] xfs/010: filter out bad finobt levels complaint
  2021-04-28  4:08 ` [PATCH 2/2] xfs/010: filter out bad finobt levels complaint Darrick J. Wong
@ 2021-04-28 17:38   ` Brian Foster
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Foster @ 2021-04-28 17:38 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests, guan

On Tue, Apr 27, 2021 at 09:08:50PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Since we're adding to xfs_repair the ability to warn about bad finobt
> levels, filter that out.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  tests/xfs/010 |    1 +
>  1 file changed, 1 insertion(+)
> 
> 
> diff --git a/tests/xfs/010 b/tests/xfs/010
> index 95cc2555..a9394077 100755
> --- a/tests/xfs/010
> +++ b/tests/xfs/010
> @@ -114,6 +114,7 @@ _corrupt_finobt_root $SCRATCH_DEV
>  
>  filter_finobt_repair() {
>  	sed -e '/^agi has bad CRC/d' \
> +	    -e '/^bad levels/d' \
>  	    -e '/^bad finobt block/d' | \
>  		_filter_repair_lostblocks
>  }
> 


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

* Re: [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs
  2021-04-28 17:38   ` Brian Foster
@ 2021-04-29  0:31     ` Darrick J. Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Darrick J. Wong @ 2021-04-29  0:31 UTC (permalink / raw)
  To: Brian Foster; +Cc: guaneryu, linux-xfs, fstests, guan

On Wed, Apr 28, 2021 at 01:38:27PM -0400, Brian Foster wrote:
> On Tue, Apr 27, 2021 at 09:08:43PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Make sure that we can reset the root directory and the xattrs are erased
> > properly.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/757     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/757.out |    7 ++++++
> >  tests/xfs/group   |    1 +
> >  3 files changed, 71 insertions(+)
> >  create mode 100755 tests/xfs/757
> >  create mode 100644 tests/xfs/757.out
> > 
> > 
> > diff --git a/tests/xfs/757 b/tests/xfs/757
> > new file mode 100755
> > index 00000000..0b9914f6
> > --- /dev/null
> > +++ b/tests/xfs/757
> > @@ -0,0 +1,63 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +# Copyright (c) 2021 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test No. 757
> > +#
> > +# Make sure that attrs are handled properly when repair has to reset the root
> > +# directory.
> > +#
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 7 15
> > +
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -rf $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +. ./common/populate
> > +. ./common/fuzzy
> > +
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_require_scratch_nocheck
> > +
> > +rm -f $seqres.full
> > +
> > +echo "Format and populate btree attr root dir"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount
> > +
> > +blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
> > +__populate_create_attr "${SCRATCH_MNT}" "$((64 * blksz / 40))" true
> > +_scratch_unmount
> > +
> > +echo "Break the root directory"
> > +_scratch_xfs_fuzz_metadata_field core.mode zeroes 'sb 0' 'addr rootino' >> $seqres.full 2>&1
> > +
> > +echo "Detect bad root directory"
> > +_scratch_xfs_repair -n >> $seqres.full 2>&1 && \
> > +	echo "Should have detected bad root dir"
> > +
> > +echo "Fix bad root directory"
> > +_scratch_xfs_repair >> $seqres.full 2>&1
> > +
> > +echo "Detect fixed root directory"
> > +_scratch_xfs_repair -n >> $seqres.full 2>&1
> > +
> > +echo "Mount test"
> > +_scratch_mount
> > +
> 
> Is the regression test here that attrs are erased after this sequence
> (as suggested in the commit log), or that the fs mounts, or both? I'm
> basically just wondering if we should also dump the xattrs on the root
> dir as a last step (and expect NULL output)..? That aside:

I've been racking my brain trying to remember where this test came from.
IIRC it was some xfs_repair segfault bug that I came across last
September.  It would manifest if the root dir had xattrs attached and
repair decided to nuke the root directory, but there aren't any obvious
patches, and I've totally forgotten the original context.  It might have
related to Dave or someone noticing that things didn't quite work with a
filesystem that had selinux enabled and the root dir got corrupt...?

Either way, thanks for the reviews :)

--D

> Reviewed-by: Brian Foster <bfoster@redhat.com>
> 
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/757.out b/tests/xfs/757.out
> > new file mode 100644
> > index 00000000..9f3aed5a
> > --- /dev/null
> > +++ b/tests/xfs/757.out
> > @@ -0,0 +1,7 @@
> > +QA output created by 757
> > +Format and populate btree attr root dir
> > +Break the root directory
> > +Detect bad root directory
> > +Fix bad root directory
> > +Detect fixed root directory
> > +Mount test
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index 731f869c..76e31167 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -528,5 +528,6 @@
> >  537 auto quick
> >  538 auto stress
> >  539 auto quick mount
> > +757 auto quick attr repair
> >  908 auto quick bigtime
> >  909 auto quick bigtime quota
> > 
> 

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

end of thread, other threads:[~2021-04-29  0:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  4:08 [PATCHSET 0/2] fstests: test xfsprogs regression fixed in 5.12 Darrick J. Wong
2021-04-28  4:08 ` [PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs Darrick J. Wong
2021-04-28 17:38   ` Brian Foster
2021-04-29  0:31     ` Darrick J. Wong
2021-04-28  4:08 ` [PATCH 2/2] xfs/010: filter out bad finobt levels complaint Darrick J. Wong
2021-04-28 17:38   ` Brian Foster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.