diff mbox series

[RFC] fstests: test fix for an agbno overflow in __xfs_getfsmap_datadev

Message ID 20230823010239.GE11263@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series [RFC] fstests: test fix for an agbno overflow in __xfs_getfsmap_datadev | expand

Commit Message

Darrick J. Wong Aug. 23, 2023, 1:02 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Dave Chinner reported that xfs/273 fails if the AG size happens to be an
exact power of two.  I traced this to an agbno integer overflow when the
current GETFSMAP call is a continuation of a previous GETFSMAP call, and
the last record returned was non-shareable space at the end of an AG.

This is the regression test for that bug.

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

Comments

Dave Chinner Aug. 24, 2023, 2:36 a.m. UTC | #1
On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> exact power of two.  I traced this to an agbno integer overflow when the
> current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> the last record returned was non-shareable space at the end of an AG.
> 
> This is the regression test for that bug.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/935     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/935.out |    2 ++
>  2 files changed, 57 insertions(+)
>  create mode 100755 tests/xfs/935
>  create mode 100644 tests/xfs/935.out
> 
> diff --git a/tests/xfs/935 b/tests/xfs/935
> new file mode 100755
> index 0000000000..a06f2fc8dc
> --- /dev/null
> +++ b/tests/xfs/935
> @@ -0,0 +1,55 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 935
> +#
> +# Regression test for an agbno overflow bug in XFS GETFSMAP involving an
> +# fsmap_advance call.  Userspace can indicate that a GETFSMAP call is actually
> +# a continuation of a previous call by setting the "low" key to the last record
> +# returned by the previous call.
> +#
> +# If the last record returned by GETFSMAP is a non-shareable extent at the end
> +# of an AG and the AG size is exactly a power of two, the startblock in the low
> +# key of the rmapbt query can be set to a value larger than EOAG.  When this
> +# happens, GETFSMAP will return EINVAL instead of returning records for the
> +# next AG.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick fsmap
> +
> +. ./common/filter
> +
> +_fixed_by_git_commit kernel XXXXXXXXXXXXX \
> +	"xfs: fix an agbno overflow in __xfs_getfsmap_datadev"
> +
> +# Modify as appropriate.
> +_supported_fs generic
> +_require_xfs_io_command fsmap
> +_require_xfs_scratch_rmapbt
> +
> +_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> +source $tmp.mkfs
> +
> +# Find the next power of two agsize smaller than whatever the default is.
> +for ((p = 31; p > 0; p--)); do
> +	desired_agsize=$((2 ** p))
> +	test "$desired_agsize" -lt "$agsize" && break
> +done
> +
> +echo "desired asize=$desired_agsize" >> $seqres.full
                 agsize

Otherwise looks fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Darrick J. Wong Aug. 24, 2023, 3:19 a.m. UTC | #2
On Thu, Aug 24, 2023 at 12:36:11PM +1000, Dave Chinner wrote:
> On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> > exact power of two.  I traced this to an agbno integer overflow when the
> > current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> > the last record returned was non-shareable space at the end of an AG.
> > 
> > This is the regression test for that bug.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/935     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/935.out |    2 ++
> >  2 files changed, 57 insertions(+)
> >  create mode 100755 tests/xfs/935
> >  create mode 100644 tests/xfs/935.out
> > 
> > diff --git a/tests/xfs/935 b/tests/xfs/935
> > new file mode 100755
> > index 0000000000..a06f2fc8dc
> > --- /dev/null
> > +++ b/tests/xfs/935
> > @@ -0,0 +1,55 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2023 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 935
> > +#
> > +# Regression test for an agbno overflow bug in XFS GETFSMAP involving an
> > +# fsmap_advance call.  Userspace can indicate that a GETFSMAP call is actually
> > +# a continuation of a previous call by setting the "low" key to the last record
> > +# returned by the previous call.
> > +#
> > +# If the last record returned by GETFSMAP is a non-shareable extent at the end
> > +# of an AG and the AG size is exactly a power of two, the startblock in the low
> > +# key of the rmapbt query can be set to a value larger than EOAG.  When this
> > +# happens, GETFSMAP will return EINVAL instead of returning records for the
> > +# next AG.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto quick fsmap
> > +
> > +. ./common/filter
> > +
> > +_fixed_by_git_commit kernel XXXXXXXXXXXXX \
> > +	"xfs: fix an agbno overflow in __xfs_getfsmap_datadev"
> > +
> > +# Modify as appropriate.
> > +_supported_fs generic
> > +_require_xfs_io_command fsmap
> > +_require_xfs_scratch_rmapbt
> > +
> > +_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> > +source $tmp.mkfs
> > +
> > +# Find the next power of two agsize smaller than whatever the default is.
> > +for ((p = 31; p > 0; p--)); do
> > +	desired_agsize=$((2 ** p))
> > +	test "$desired_agsize" -lt "$agsize" && break
> > +done
> > +
> > +echo "desired asize=$desired_agsize" >> $seqres.full
>                  agsize

Fixed.

> Otherwise looks fine.
> 
> Reviewed-by: Dave Chinner <dchinner@redhat.com>

Does the kernel patch fix the bug on your end too?

--D

> -- 
> Dave Chinner
> david@fromorbit.com
Dave Chinner Aug. 24, 2023, 3:42 a.m. UTC | #3
On Wed, Aug 23, 2023 at 08:19:39PM -0700, Darrick J. Wong wrote:
> On Thu, Aug 24, 2023 at 12:36:11PM +1000, Dave Chinner wrote:
> > On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> > > exact power of two.  I traced this to an agbno integer overflow when the
> > > current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> > > the last record returned was non-shareable space at the end of an AG.
> > > 
> > > This is the regression test for that bug.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > >  tests/xfs/935     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  tests/xfs/935.out |    2 ++
> > >  2 files changed, 57 insertions(+)
> > >  create mode 100755 tests/xfs/935
> > >  create mode 100644 tests/xfs/935.out
> > > 
> > > diff --git a/tests/xfs/935 b/tests/xfs/935
> > > new file mode 100755
> > > index 0000000000..a06f2fc8dc
> > > --- /dev/null
> > > +++ b/tests/xfs/935
> > > @@ -0,0 +1,55 @@
> > > +#! /bin/bash
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +# Copyright (c) 2023 Oracle.  All Rights Reserved.
> > > +#
> > > +# FS QA Test 935
> > > +#
> > > +# Regression test for an agbno overflow bug in XFS GETFSMAP involving an
> > > +# fsmap_advance call.  Userspace can indicate that a GETFSMAP call is actually
> > > +# a continuation of a previous call by setting the "low" key to the last record
> > > +# returned by the previous call.
> > > +#
> > > +# If the last record returned by GETFSMAP is a non-shareable extent at the end
> > > +# of an AG and the AG size is exactly a power of two, the startblock in the low
> > > +# key of the rmapbt query can be set to a value larger than EOAG.  When this
> > > +# happens, GETFSMAP will return EINVAL instead of returning records for the
> > > +# next AG.
> > > +#
> > > +. ./common/preamble
> > > +_begin_fstest auto quick fsmap
> > > +
> > > +. ./common/filter
> > > +
> > > +_fixed_by_git_commit kernel XXXXXXXXXXXXX \
> > > +	"xfs: fix an agbno overflow in __xfs_getfsmap_datadev"
> > > +
> > > +# Modify as appropriate.
> > > +_supported_fs generic
> > > +_require_xfs_io_command fsmap
> > > +_require_xfs_scratch_rmapbt
> > > +
> > > +_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> > > +source $tmp.mkfs
> > > +
> > > +# Find the next power of two agsize smaller than whatever the default is.
> > > +for ((p = 31; p > 0; p--)); do
> > > +	desired_agsize=$((2 ** p))
> > > +	test "$desired_agsize" -lt "$agsize" && break
> > > +done
> > > +
> > > +echo "desired asize=$desired_agsize" >> $seqres.full
> >                  agsize
> 
> Fixed.
> 
> > Otherwise looks fine.
> > 
> > Reviewed-by: Dave Chinner <dchinner@redhat.com>
> 
> Does the kernel patch fix the bug on your end too?

Haven't had a chance to test it yet. I'll let you know when I do.

-Dave.
Zorro Lang Aug. 27, 2023, 1:06 p.m. UTC | #4
On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> exact power of two.  I traced this to an agbno integer overflow when the
> current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> the last record returned was non-shareable space at the end of an AG.
> 
> This is the regression test for that bug.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/935     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/935.out |    2 ++
>  2 files changed, 57 insertions(+)
>  create mode 100755 tests/xfs/935
>  create mode 100644 tests/xfs/935.out
> 
> diff --git a/tests/xfs/935 b/tests/xfs/935
> new file mode 100755
> index 0000000000..a06f2fc8dc
> --- /dev/null
> +++ b/tests/xfs/935
> @@ -0,0 +1,55 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 935
> +#
> +# Regression test for an agbno overflow bug in XFS GETFSMAP involving an
> +# fsmap_advance call.  Userspace can indicate that a GETFSMAP call is actually
> +# a continuation of a previous call by setting the "low" key to the last record
> +# returned by the previous call.
> +#
> +# If the last record returned by GETFSMAP is a non-shareable extent at the end
> +# of an AG and the AG size is exactly a power of two, the startblock in the low
> +# key of the rmapbt query can be set to a value larger than EOAG.  When this
> +# happens, GETFSMAP will return EINVAL instead of returning records for the
> +# next AG.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick fsmap
> +
> +. ./common/filter
> +
> +_fixed_by_git_commit kernel XXXXXXXXXXXXX \
> +	"xfs: fix an agbno overflow in __xfs_getfsmap_datadev"
> +
> +# Modify as appropriate.
> +_supported_fs generic
> +_require_xfs_io_command fsmap
> +_require_xfs_scratch_rmapbt
> +
> +_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> +source $tmp.mkfs
> +
> +# Find the next power of two agsize smaller than whatever the default is.
> +for ((p = 31; p > 0; p--)); do
> +	desired_agsize=$((2 ** p))
> +	test "$desired_agsize" -lt "$agsize" && break
> +done
> +
> +echo "desired asize=$desired_agsize" >> $seqres.full
> +_scratch_mkfs -d "agsize=${desired_agsize}b" | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> +source $tmp.mkfs
> +
> +test "$desired_agsize" -eq "$agsize" || _notrun "wanted agsize=$desired_agsize, got $agsize"
> +
> +_scratch_mount
> +$XFS_IO_PROG -c 'fsmap -n 1024 -v' $SCRATCH_MNT >> $tmp.big
> +$XFS_IO_PROG -c 'fsmap -n 1 -v' $SCRATCH_MNT >> $tmp.small

This line reports:

  xfs_io: xfsctl(XFS_IOC_GETFSMAP) iflags=0x0 ["/mnt/xfstests/scratch"]: Invalid argument

when the test case fails. Is that normal?

> +
> +diff -Naurpw $tmp.big $tmp.small
> +
> +# success, all done
> +echo Silence is golden
> +status=0
> +exit
> diff --git a/tests/xfs/935.out b/tests/xfs/935.out
> new file mode 100644
> index 0000000000..1b5422d1e3
> --- /dev/null
> +++ b/tests/xfs/935.out
> @@ -0,0 +1,2 @@
> +QA output created by 935
> +Silence is golden
>
Darrick J. Wong Aug. 27, 2023, 3:56 p.m. UTC | #5
On Sun, Aug 27, 2023 at 09:06:44PM +0800, Zorro Lang wrote:
> On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> > exact power of two.  I traced this to an agbno integer overflow when the
> > current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> > the last record returned was non-shareable space at the end of an AG.
> > 
> > This is the regression test for that bug.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/935     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/935.out |    2 ++
> >  2 files changed, 57 insertions(+)
> >  create mode 100755 tests/xfs/935
> >  create mode 100644 tests/xfs/935.out
> > 
> > diff --git a/tests/xfs/935 b/tests/xfs/935
> > new file mode 100755
> > index 0000000000..a06f2fc8dc
> > --- /dev/null
> > +++ b/tests/xfs/935
> > @@ -0,0 +1,55 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2023 Oracle.  All Rights Reserved.
> > +#
> > +# FS QA Test 935
> > +#
> > +# Regression test for an agbno overflow bug in XFS GETFSMAP involving an
> > +# fsmap_advance call.  Userspace can indicate that a GETFSMAP call is actually
> > +# a continuation of a previous call by setting the "low" key to the last record
> > +# returned by the previous call.
> > +#
> > +# If the last record returned by GETFSMAP is a non-shareable extent at the end
> > +# of an AG and the AG size is exactly a power of two, the startblock in the low
> > +# key of the rmapbt query can be set to a value larger than EOAG.  When this
> > +# happens, GETFSMAP will return EINVAL instead of returning records for the
> > +# next AG.
> > +#
> > +. ./common/preamble
> > +_begin_fstest auto quick fsmap
> > +
> > +. ./common/filter
> > +
> > +_fixed_by_git_commit kernel XXXXXXXXXXXXX \
> > +	"xfs: fix an agbno overflow in __xfs_getfsmap_datadev"
> > +
> > +# Modify as appropriate.
> > +_supported_fs generic
> > +_require_xfs_io_command fsmap
> > +_require_xfs_scratch_rmapbt
> > +
> > +_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> > +source $tmp.mkfs
> > +
> > +# Find the next power of two agsize smaller than whatever the default is.
> > +for ((p = 31; p > 0; p--)); do
> > +	desired_agsize=$((2 ** p))
> > +	test "$desired_agsize" -lt "$agsize" && break
> > +done
> > +
> > +echo "desired asize=$desired_agsize" >> $seqres.full
> > +_scratch_mkfs -d "agsize=${desired_agsize}b" | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> > +source $tmp.mkfs
> > +
> > +test "$desired_agsize" -eq "$agsize" || _notrun "wanted agsize=$desired_agsize, got $agsize"
> > +
> > +_scratch_mount
> > +$XFS_IO_PROG -c 'fsmap -n 1024 -v' $SCRATCH_MNT >> $tmp.big
> > +$XFS_IO_PROG -c 'fsmap -n 1 -v' $SCRATCH_MNT >> $tmp.small
> 
> This line reports:
> 
>   xfs_io: xfsctl(XFS_IOC_GETFSMAP) iflags=0x0 ["/mnt/xfstests/scratch"]: Invalid argument
> 
> when the test case fails. Is that normal?

Yes.  The attached bugfix should make that go away.

--D

> > +
> > +diff -Naurpw $tmp.big $tmp.small
> > +
> > +# success, all done
> > +echo Silence is golden
> > +status=0
> > +exit
> > diff --git a/tests/xfs/935.out b/tests/xfs/935.out
> > new file mode 100644
> > index 0000000000..1b5422d1e3
> > --- /dev/null
> > +++ b/tests/xfs/935.out
> > @@ -0,0 +1,2 @@
> > +QA output created by 935
> > +Silence is golden
> > 
>
Dave Chinner Aug. 28, 2023, 2 a.m. UTC | #6
On Sun, Aug 27, 2023 at 08:56:46AM -0700, Darrick J. Wong wrote:
> On Sun, Aug 27, 2023 at 09:06:44PM +0800, Zorro Lang wrote:
> > On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> > > exact power of two.  I traced this to an agbno integer overflow when the
> > > current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> > > the last record returned was non-shareable space at the end of an AG.
> > > 
> > > This is the regression test for that bug.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
.....
> > > +echo "desired asize=$desired_agsize" >> $seqres.full
> > > +_scratch_mkfs -d "agsize=${desired_agsize}b" | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> > > +source $tmp.mkfs
> > > +
> > > +test "$desired_agsize" -eq "$agsize" || _notrun "wanted agsize=$desired_agsize, got $agsize"
> > > +
> > > +_scratch_mount
> > > +$XFS_IO_PROG -c 'fsmap -n 1024 -v' $SCRATCH_MNT >> $tmp.big
> > > +$XFS_IO_PROG -c 'fsmap -n 1 -v' $SCRATCH_MNT >> $tmp.small
> > 
> > This line reports:
> > 
> >   xfs_io: xfsctl(XFS_IOC_GETFSMAP) iflags=0x0 ["/mnt/xfstests/scratch"]: Invalid argument
> > 
> > when the test case fails. Is that normal?
> 
> Yes.  The attached bugfix should make that go away.

The kernel bug fix fixes the same problem with xfs/273; I haven't
tested this specific new regression test.

-Dave.
Zorro Lang Aug. 28, 2023, 2:24 p.m. UTC | #7
On Mon, Aug 28, 2023 at 12:00:59PM +1000, Dave Chinner wrote:
> On Sun, Aug 27, 2023 at 08:56:46AM -0700, Darrick J. Wong wrote:
> > On Sun, Aug 27, 2023 at 09:06:44PM +0800, Zorro Lang wrote:
> > > On Tue, Aug 22, 2023 at 06:02:39PM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Dave Chinner reported that xfs/273 fails if the AG size happens to be an
> > > > exact power of two.  I traced this to an agbno integer overflow when the
> > > > current GETFSMAP call is a continuation of a previous GETFSMAP call, and
> > > > the last record returned was non-shareable space at the end of an AG.
> > > > 
> > > > This is the regression test for that bug.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> .....
> > > > +echo "desired asize=$desired_agsize" >> $seqres.full
> > > > +_scratch_mkfs -d "agsize=${desired_agsize}b" | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
> > > > +source $tmp.mkfs
> > > > +
> > > > +test "$desired_agsize" -eq "$agsize" || _notrun "wanted agsize=$desired_agsize, got $agsize"
> > > > +
> > > > +_scratch_mount
> > > > +$XFS_IO_PROG -c 'fsmap -n 1024 -v' $SCRATCH_MNT >> $tmp.big
> > > > +$XFS_IO_PROG -c 'fsmap -n 1 -v' $SCRATCH_MNT >> $tmp.small
> > > 
> > > This line reports:
> > > 
> > >   xfs_io: xfsctl(XFS_IOC_GETFSMAP) iflags=0x0 ["/mnt/xfstests/scratch"]: Invalid argument
> > > 
> > > when the test case fails. Is that normal?
> > 
> > Yes.  The attached bugfix should make that go away.
> 
> The kernel bug fix fixes the same problem with xfs/273; I haven't
> tested this specific new regression test.

Thanks for the details from both of you, I'll merge this patch in next fstests
release if there's not more updates.

Thanks,
Zorro

> 
> -Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
>
diff mbox series

Patch

diff --git a/tests/xfs/935 b/tests/xfs/935
new file mode 100755
index 0000000000..a06f2fc8dc
--- /dev/null
+++ b/tests/xfs/935
@@ -0,0 +1,55 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Oracle.  All Rights Reserved.
+#
+# FS QA Test 935
+#
+# Regression test for an agbno overflow bug in XFS GETFSMAP involving an
+# fsmap_advance call.  Userspace can indicate that a GETFSMAP call is actually
+# a continuation of a previous call by setting the "low" key to the last record
+# returned by the previous call.
+#
+# If the last record returned by GETFSMAP is a non-shareable extent at the end
+# of an AG and the AG size is exactly a power of two, the startblock in the low
+# key of the rmapbt query can be set to a value larger than EOAG.  When this
+# happens, GETFSMAP will return EINVAL instead of returning records for the
+# next AG.
+#
+. ./common/preamble
+_begin_fstest auto quick fsmap
+
+. ./common/filter
+
+_fixed_by_git_commit kernel XXXXXXXXXXXXX \
+	"xfs: fix an agbno overflow in __xfs_getfsmap_datadev"
+
+# Modify as appropriate.
+_supported_fs generic
+_require_xfs_io_command fsmap
+_require_xfs_scratch_rmapbt
+
+_scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
+source $tmp.mkfs
+
+# Find the next power of two agsize smaller than whatever the default is.
+for ((p = 31; p > 0; p--)); do
+	desired_agsize=$((2 ** p))
+	test "$desired_agsize" -lt "$agsize" && break
+done
+
+echo "desired asize=$desired_agsize" >> $seqres.full
+_scratch_mkfs -d "agsize=${desired_agsize}b" | _filter_mkfs 2> $tmp.mkfs >> $seqres.full
+source $tmp.mkfs
+
+test "$desired_agsize" -eq "$agsize" || _notrun "wanted agsize=$desired_agsize, got $agsize"
+
+_scratch_mount
+$XFS_IO_PROG -c 'fsmap -n 1024 -v' $SCRATCH_MNT >> $tmp.big
+$XFS_IO_PROG -c 'fsmap -n 1 -v' $SCRATCH_MNT >> $tmp.small
+
+diff -Naurpw $tmp.big $tmp.small
+
+# success, all done
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/935.out b/tests/xfs/935.out
new file mode 100644
index 0000000000..1b5422d1e3
--- /dev/null
+++ b/tests/xfs/935.out
@@ -0,0 +1,2 @@ 
+QA output created by 935
+Silence is golden