diff mbox series

[1/5] xfs/529: fix bogus failure when realtime is configured

Message ID 168840381873.1317961.17241883212352752910.stgit@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes for v2023.06.18 | expand

Commit Message

Darrick J. Wong July 3, 2023, 5:03 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

If I have a realtime volume configured, this test will sometimes trip
over this:

XFS: Assertion failed: nmaps == 1, file: fs/xfs/xfs_dquot.c, line: 360
Call Trace:
 xfs_dquot_disk_alloc+0x3dc/0x400 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
 xfs_qm_dqread+0xc9/0x190 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
 xfs_qm_dqget+0xa8/0x230 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
 xfs_qm_vop_dqalloc+0x160/0x600 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
 xfs_setattr_nonsize+0x318/0x520 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
 notify_change+0x30e/0x490
 chown_common+0x13e/0x1f0
 do_fchownat+0x8d/0xe0
 __x64_sys_fchownat+0x1b/0x20
 do_syscall_64+0x2b/0x80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7fa6985e2cae

The test injects the bmap_alloc_minlen_extent error, which refuses to
allocate file space unless it's exactly minlen long.  However, a
precondition of this injection point is that the free space on the data
device must be sufficiently fragmented that there are small free
extents.

However, if realtime and rtinherit are enabled, the punch-alternating
call will operate on a realtime file, which only serves to write 0x55
patterns into the realtime bitmap.  Hence the test preconditions are not
satisfied, so the test is not serving its purpose.

Fix it by disabling rtinherit=1 on the rootdir so that we actually
fragment the bnobt/cntbt as required.

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

Comments

Andrey Albershteyn July 4, 2023, 1:52 p.m. UTC | #1
On 2023-07-03 10:03:38, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If I have a realtime volume configured, this test will sometimes trip
> over this:
> 
> XFS: Assertion failed: nmaps == 1, file: fs/xfs/xfs_dquot.c, line: 360
> Call Trace:
>  xfs_dquot_disk_alloc+0x3dc/0x400 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
>  xfs_qm_dqread+0xc9/0x190 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
>  xfs_qm_dqget+0xa8/0x230 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
>  xfs_qm_vop_dqalloc+0x160/0x600 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
>  xfs_setattr_nonsize+0x318/0x520 [xfs 97e1fa8953d397b1fb9732df4de7fa9070bda501]
>  notify_change+0x30e/0x490
>  chown_common+0x13e/0x1f0
>  do_fchownat+0x8d/0xe0
>  __x64_sys_fchownat+0x1b/0x20
>  do_syscall_64+0x2b/0x80
>  entry_SYSCALL_64_after_hwframe+0x46/0xb0
> RIP: 0033:0x7fa6985e2cae
> 
> The test injects the bmap_alloc_minlen_extent error, which refuses to
> allocate file space unless it's exactly minlen long.  However, a
> precondition of this injection point is that the free space on the data
> device must be sufficiently fragmented that there are small free
> extents.
> 
> However, if realtime and rtinherit are enabled, the punch-alternating
> call will operate on a realtime file, which only serves to write 0x55
> patterns into the realtime bitmap.  Hence the test preconditions are not
> satisfied, so the test is not serving its purpose.
> 
> Fix it by disabling rtinherit=1 on the rootdir so that we actually
> fragment the bnobt/cntbt as required.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/xfs/529 |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> 
> diff --git a/tests/xfs/529 b/tests/xfs/529
> index 83d24da0ac..cd176877f5 100755
> --- a/tests/xfs/529
> +++ b/tests/xfs/529
> @@ -32,6 +32,10 @@ echo "Format and mount fs"
>  _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full
>  _scratch_mount -o uquota >> $seqres.full
>  
> +# bmap_alloc_minlen_extent only applies to the datadev space allocator, so
> +# we force the filesystem not to use the realtime volume.
> +_xfs_force_bdev data $SCRATCH_MNT
> +

Looks good to me:
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
diff mbox series

Patch

diff --git a/tests/xfs/529 b/tests/xfs/529
index 83d24da0ac..cd176877f5 100755
--- a/tests/xfs/529
+++ b/tests/xfs/529
@@ -32,6 +32,10 @@  echo "Format and mount fs"
 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full
 _scratch_mount -o uquota >> $seqres.full
 
+# bmap_alloc_minlen_extent only applies to the datadev space allocator, so
+# we force the filesystem not to use the realtime volume.
+_xfs_force_bdev data $SCRATCH_MNT
+
 bsize=$(_get_file_block_size $SCRATCH_MNT)
 
 echo "* Delalloc to written extent conversion"