fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC PATCH] generic: regression test for a FALLOC_FL_UNSHARE bug in XFS
       [not found] ` <20210824003835.GD12640@magnolia>
@ 2021-08-24  9:33   ` Zorro Lang
  2021-08-24 15:17     ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Zorro Lang @ 2021-08-24  9:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs, fstests

On Mon, Aug 23, 2021 at 05:38:35PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> This is a regression test for "xfs: only set IOMAP_F_SHARED when
> providing a srcmap to a write".
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/generic/729     |   73 +++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/729.out |    2 +
>  2 files changed, 75 insertions(+)
>  create mode 100755 tests/generic/729
>  create mode 100644 tests/generic/729.out
> 
> diff --git a/tests/generic/729 b/tests/generic/729
> new file mode 100755
> index 00000000..269aed65
> --- /dev/null
> +++ b/tests/generic/729
> @@ -0,0 +1,73 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2021 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 729
> +#
> +# This is a regression test for "xfs: only set IOMAP_F_SHARED when providing a
> +# srcmap to a write".  If a user creates a sparse shared region in a file,
> +# convinces XFS to create a copy-on-write delayed allocation reservation
> +# spanning both the shared blocks and the holes, and then calls the fallocate
> +# unshare command to unshare the entire sparse region, XFS incorrectly tells
> +# iomap that the delalloc blocks for the holes are shared, which causes it to
> +# error out while trying to unshare a hole.
> +#
> +. ./common/preamble
> +_begin_fstest auto clone unshare
> +
> +# Override the default cleanup function.
> +_cleanup()
> +{
> +	cd /
> +	rm -r -f $tmp.* $TEST_DIR/$seq
> +}
> +
> +# Import common functions.
> +. ./common/reflink
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs generic
> +_require_cp_reflink
> +_require_test_reflink
> +_require_test_program "punch-alternating"
> +_require_xfs_io_command "fpunch"

I didn't find "fpunch" in this case, but find "cowextsize". Did I
miss something?

Others looks good to me.
Reviewed-by: Zorro Lang <zlang@redhat.com>

cc fstests@vger.kernel.org, due to it's a patch to xfstests.

Thanks,
Zorro

> +_require_xfs_io_command "funshare"
> +
> +mkdir $TEST_DIR/$seq
> +file1=$TEST_DIR/$seq/a
> +file2=$TEST_DIR/$seq/b
> +
> +$XFS_IO_PROG -f -c "pwrite -S 0x58 -b 10m 0 10m" $file1 >> $seqres.full
> +
> +f1sum0="$(md5sum $file1 | _filter_test_dir)"
> +
> +_cp_reflink $file1 $file2
> +$here/src/punch-alternating -o 1 $file2
> +
> +f2sum0="$(md5sum $file2 | _filter_test_dir)"
> +
> +# set cowextsize to the defaults (128k) to force delalloc cow preallocations
> +test "$FSTYP" = "xfs" && $XFS_IO_PROG -c 'cowextsize 0' $file2
> +$XFS_IO_PROG -c "funshare 0 10m" $file2
> +
> +f1sum1="$(md5sum $file1 | _filter_test_dir)"
> +f2sum1="$(md5sum $file2 | _filter_test_dir)"
> +
> +test "${f1sum0}" = "${f1sum1}" || echo "file1 should not have changed"
> +test "${f2sum0}" = "${f2sum1}" || echo "file2 should not have changed"
> +
> +_test_cycle_mount
> +
> +f1sum2="$(md5sum $file1 | _filter_test_dir)"
> +f2sum2="$(md5sum $file2 | _filter_test_dir)"
> +
> +test "${f1sum2}" = "${f1sum1}" || echo "file1 should not have changed ondisk"
> +test "${f2sum2}" = "${f2sum1}" || echo "file2 should not have changed ondisk"
> +
> +# success, all done
> +echo Silence is golden
> +status=0
> +exit
> diff --git a/tests/generic/729.out b/tests/generic/729.out
> new file mode 100644
> index 00000000..0f175ae2
> --- /dev/null
> +++ b/tests/generic/729.out
> @@ -0,0 +1,2 @@
> +QA output created by 729
> +Silence is golden
> 


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

* Re: [RFC PATCH] generic: regression test for a FALLOC_FL_UNSHARE bug in XFS
  2021-08-24  9:33   ` [RFC PATCH] generic: regression test for a FALLOC_FL_UNSHARE bug in XFS Zorro Lang
@ 2021-08-24 15:17     ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2021-08-24 15:17 UTC (permalink / raw)
  To: xfs, fstests

On Tue, Aug 24, 2021 at 05:33:28PM +0800, Zorro Lang wrote:
> On Mon, Aug 23, 2021 at 05:38:35PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > This is a regression test for "xfs: only set IOMAP_F_SHARED when
> > providing a srcmap to a write".
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/generic/729     |   73 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/generic/729.out |    2 +
> >  2 files changed, 75 insertions(+)
> >  create mode 100755 tests/generic/729
> >  create mode 100644 tests/generic/729.out
> > 
> > diff --git a/tests/generic/729 b/tests/generic/729
> > new file mode 100755
> > index 00000000..269aed65
> > --- /dev/null
> > +++ b/tests/generic/729
> > @@ -0,0 +1,73 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2021 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 729
> > +#
> > +# This is a regression test for "xfs: only set IOMAP_F_SHARED when providing a
> > +# srcmap to a write".  If a user creates a sparse shared region in a file,
> > +# convinces XFS to create a copy-on-write delayed allocation reservation
> > +# spanning both the shared blocks and the holes, and then calls the fallocate
> > +# unshare command to unshare the entire sparse region, XFS incorrectly tells
> > +# iomap that the delalloc blocks for the holes are shared, which causes it to
> > +# error out while trying to unshare a hole.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto clone unshare
> > +
> > +# Override the default cleanup function.
> > +_cleanup()
> > +{
> > +	cd /
> > +	rm -r -f $tmp.* $TEST_DIR/$seq
> > +}
> > +
> > +# Import common functions.
> > +. ./common/reflink
> > +. ./common/filter
> > +
> > +# real QA test starts here
> > +
> > +# Modify as appropriate.
> > +_supported_fs generic
> > +_require_cp_reflink
> > +_require_test_reflink
> > +_require_test_program "punch-alternating"
> > +_require_xfs_io_command "fpunch"
> 
> I didn't find "fpunch" in this case,

It covers the punch activities in punch-alternating.  I'll add a comment
pointing out that subtlety.

> but find "cowextsize". Did I miss something?

Oops.  Yes, I'll add that too.

> Others looks good to me.
> Reviewed-by: Zorro Lang <zlang@redhat.com>
> 
> cc fstests@vger.kernel.org, due to it's a patch to xfstests.

<nod> Thanks for reviewing.

--D

> Thanks,
> Zorro
> 
> > +_require_xfs_io_command "funshare"
> > +
> > +mkdir $TEST_DIR/$seq
> > +file1=$TEST_DIR/$seq/a
> > +file2=$TEST_DIR/$seq/b
> > +
> > +$XFS_IO_PROG -f -c "pwrite -S 0x58 -b 10m 0 10m" $file1 >> $seqres.full
> > +
> > +f1sum0="$(md5sum $file1 | _filter_test_dir)"
> > +
> > +_cp_reflink $file1 $file2
> > +$here/src/punch-alternating -o 1 $file2
> > +
> > +f2sum0="$(md5sum $file2 | _filter_test_dir)"
> > +
> > +# set cowextsize to the defaults (128k) to force delalloc cow preallocations
> > +test "$FSTYP" = "xfs" && $XFS_IO_PROG -c 'cowextsize 0' $file2
> > +$XFS_IO_PROG -c "funshare 0 10m" $file2
> > +
> > +f1sum1="$(md5sum $file1 | _filter_test_dir)"
> > +f2sum1="$(md5sum $file2 | _filter_test_dir)"
> > +
> > +test "${f1sum0}" = "${f1sum1}" || echo "file1 should not have changed"
> > +test "${f2sum0}" = "${f2sum1}" || echo "file2 should not have changed"
> > +
> > +_test_cycle_mount
> > +
> > +f1sum2="$(md5sum $file1 | _filter_test_dir)"
> > +f2sum2="$(md5sum $file2 | _filter_test_dir)"
> > +
> > +test "${f1sum2}" = "${f1sum1}" || echo "file1 should not have changed ondisk"
> > +test "${f2sum2}" = "${f2sum1}" || echo "file2 should not have changed ondisk"
> > +
> > +# success, all done
> > +echo Silence is golden
> > +status=0
> > +exit
> > diff --git a/tests/generic/729.out b/tests/generic/729.out
> > new file mode 100644
> > index 00000000..0f175ae2
> > --- /dev/null
> > +++ b/tests/generic/729.out
> > @@ -0,0 +1,2 @@
> > +QA output created by 729
> > +Silence is golden
> > 
> 

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

end of thread, other threads:[~2021-08-24 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210824003739.GC12640@magnolia>
     [not found] ` <20210824003835.GD12640@magnolia>
2021-08-24  9:33   ` [RFC PATCH] generic: regression test for a FALLOC_FL_UNSHARE bug in XFS Zorro Lang
2021-08-24 15:17     ` Darrick J. Wong

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