diff mbox series

[4/9] xfs: test xfs_copy doesn't do cached read before libxfs_mount

Message ID 165644770013.1045534.5572366430392518217.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong June 28, 2022, 8:21 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

This is a regression test for an xfs_copy fix that ensures that it
doesn't perform a cached read of an XFS filesystem prior to initializing
libxfs, since the xfs_mount (and hence the buffer cache) isn't set up
yet.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/844     |   33 +++++++++++++++++++++++++++++++++
 tests/xfs/844.out |    3 +++
 2 files changed, 36 insertions(+)
 create mode 100755 tests/xfs/844
 create mode 100644 tests/xfs/844.out

Comments

Dave Chinner June 29, 2022, 4:20 a.m. UTC | #1
On Tue, Jun 28, 2022 at 01:21:40PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> This is a regression test for an xfs_copy fix that ensures that it
> doesn't perform a cached read of an XFS filesystem prior to initializing
> libxfs, since the xfs_mount (and hence the buffer cache) isn't set up
> yet.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/844     |   33 +++++++++++++++++++++++++++++++++
>  tests/xfs/844.out |    3 +++
>  2 files changed, 36 insertions(+)
>  create mode 100755 tests/xfs/844
>  create mode 100644 tests/xfs/844.out
> 
> 
> diff --git a/tests/xfs/844 b/tests/xfs/844
> new file mode 100755
> index 00000000..688abe33
> --- /dev/null
> +++ b/tests/xfs/844
> @@ -0,0 +1,33 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 844
> +#
> +# Regression test for xfsprogs commit:
> +#
> +# XXXXXXXX ("xfs_copy: don't use cached buffer reads until after libxfs_mount")
> +#

This needs more of an explanation of why empty files are being
copied here, because it's not obvious why we'd run xfs_copy on
them...

> +. ./common/preamble
> +_begin_fstest auto copy

Wouldn't this also be quick?

Otherwise looks fine.

Cheers,

Dave.
Darrick J. Wong June 29, 2022, 10:46 p.m. UTC | #2
On Wed, Jun 29, 2022 at 02:20:45PM +1000, Dave Chinner wrote:
> On Tue, Jun 28, 2022 at 01:21:40PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > This is a regression test for an xfs_copy fix that ensures that it
> > doesn't perform a cached read of an XFS filesystem prior to initializing
> > libxfs, since the xfs_mount (and hence the buffer cache) isn't set up
> > yet.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/844     |   33 +++++++++++++++++++++++++++++++++
> >  tests/xfs/844.out |    3 +++
> >  2 files changed, 36 insertions(+)
> >  create mode 100755 tests/xfs/844
> >  create mode 100644 tests/xfs/844.out
> > 
> > 
> > diff --git a/tests/xfs/844 b/tests/xfs/844
> > new file mode 100755
> > index 00000000..688abe33
> > --- /dev/null
> > +++ b/tests/xfs/844
> > @@ -0,0 +1,33 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2022 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 844
> > +#
> > +# Regression test for xfsprogs commit:
> > +#
> > +# XXXXXXXX ("xfs_copy: don't use cached buffer reads until after libxfs_mount")
> > +#
> 
> This needs more of an explanation of why empty files are being
> copied here, because it's not obvious why we'd run xfs_copy on
> them...

Oops, I forgot to explain what this thing is actually testing.

> > +. ./common/preamble
> > +_begin_fstest auto copy
> 
> Wouldn't this also be quick?

Yeah.  Will fix both and resubmit.

--D

> Otherwise looks fine.
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
diff mbox series

Patch

diff --git a/tests/xfs/844 b/tests/xfs/844
new file mode 100755
index 00000000..688abe33
--- /dev/null
+++ b/tests/xfs/844
@@ -0,0 +1,33 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle.  All Rights Reserved.
+#
+# FS QA Test 844
+#
+# Regression test for xfsprogs commit:
+#
+# XXXXXXXX ("xfs_copy: don't use cached buffer reads until after libxfs_mount")
+#
+. ./common/preamble
+_begin_fstest auto copy
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_xfs_copy
+_require_test
+
+rm -f $TEST_DIR/$seq.*
+$XFS_IO_PROG -f -c 'truncate 100m' $TEST_DIR/$seq.a
+$XFS_IO_PROG -f -c 'truncate 100m' $TEST_DIR/$seq.b
+
+filter_copy() {
+	sed -e 's/Superblock has bad magic number.*/bad magic number/'
+}
+
+$XFS_COPY_PROG $TEST_DIR/$seq.a $TEST_DIR/$seq.b 2>&1 | filter_copy
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/844.out b/tests/xfs/844.out
new file mode 100644
index 00000000..dbefde1c
--- /dev/null
+++ b/tests/xfs/844.out
@@ -0,0 +1,3 @@ 
+QA output created by 844
+bad magic number
+xfs_copy: couldn't read superblock, error=22