* Re: [PATCH] xfs: test xfs_copy doesn't do cached read before libxfs_mount
2022-05-24 19:54 ` [PATCH] xfs: test xfs_copy doesn't do cached read before libxfs_mount Darrick J. Wong
@ 2022-05-24 23:47 ` Dave Chinner
2022-05-25 4:02 ` Zorro Lang
1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2022-05-24 23:47 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eric Sandeen, Zorro Lang, xfs, fstests
On Tue, May 24, 2022 at 12:54:17PM -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 | 37 +++++++++++++++++++++++++++++++++++++
> tests/xfs/844.out | 3 +++
> 3 files changed, 40 insertions(+), 1 deletion(-)
> 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..720f45bb
> --- /dev/null
> +++ b/tests/xfs/844
> @@ -0,0 +1,37 @@
> +#! /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
> +
> +_cleanup()
> +{
> + cd /
> + rm -r -f $tmp.* $TEST_DIR/$seq.*
> +}
Not necessary - $TEST_DIR/$seq.* are sparse files that take up no space.
> +
> +# Import common functions.
> +# . ./common/filter
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs generic
> +_require_xfs_copy
> +_require_test
> +
rm -f $TEST_DIR/$seq.*
To set up known initial state prior to starting the test.
Otherwise looks OK.
Cheers,
Dave.
> +truncate -s 100m $TEST_DIR/$seq.a
> +truncate -s 100m $TEST_DIR/$seq.b
> +
> +$XFS_COPY_PROG $TEST_DIR/$seq.a $TEST_DIR/$seq.b
> +
> +# 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
>
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: test xfs_copy doesn't do cached read before libxfs_mount
2022-05-24 19:54 ` [PATCH] xfs: test xfs_copy doesn't do cached read before libxfs_mount Darrick J. Wong
2022-05-24 23:47 ` Dave Chinner
@ 2022-05-25 4:02 ` Zorro Lang
1 sibling, 0 replies; 3+ messages in thread
From: Zorro Lang @ 2022-05-25 4:02 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eric Sandeen, xfs, fstests
On Tue, May 24, 2022 at 12:54:17PM -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 | 37 +++++++++++++++++++++++++++++++++++++
> tests/xfs/844.out | 3 +++
> 3 files changed, 40 insertions(+), 1 deletion(-)
> 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..720f45bb
> --- /dev/null
> +++ b/tests/xfs/844
> @@ -0,0 +1,37 @@
> +#! /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")
^^^ I'd like to merge a test after it's fixed offically at first, anyway that
doesn't prevent us from reviewing it at first :)
> +#
> +. ./common/preamble
> +_begin_fstest auto copy
> +
> +_cleanup()
> +{
> + cd /
> + rm -r -f $tmp.* $TEST_DIR/$seq.*
> +}
> +
> +# Import common functions.
> +# . ./common/filter
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
"Modify as appropriate." can be removed.
> +_supported_fs generic
> +_require_xfs_copy
> +_require_test
> +
> +truncate -s 100m $TEST_DIR/$seq.a
> +truncate -s 100m $TEST_DIR/$seq.b
fstests recommends using "truncate" of XFS_IO_PROG, although use 'truncate'
isn't wrong at here.
As TEST_DIR might have existed files, do we need to do
rm -rf $TEST_DIR/$seq.a $TEST_DIR/$seq.b
at first?
Thanks,
Zorro
> +
> +$XFS_COPY_PROG $TEST_DIR/$seq.a $TEST_DIR/$seq.b
> +
> +# 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread