diff mbox series

xfs: set minleft correctly for randomly sparse inode allocations

Message ID 20221230062229.211186-1-guoxuenan@huawei.com (mailing list archive)
State Deferred, archived
Headers show
Series xfs: set minleft correctly for randomly sparse inode allocations | expand

Commit Message

Guo Xuenan Dec. 30, 2022, 6:22 a.m. UTC
In DEBUG mode may do sparse inode allocations randomly, but forget to
set the remaining space correctly for the inode btree to split.
It's OK for most cases, only under DEBUG mode and AG space is running
out may bring something bad.

Fixes: 1cdadee11f8d ("xfs: randomly do sparse inode allocations in DEBUG mode")
Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
---
 fs/xfs/libxfs/xfs_ialloc.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 94db50eb706a..29bc160312ec 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -763,6 +763,8 @@  xfs_ialloc_ag_alloc(
 		args.alignment = args.mp->m_sb.sb_spino_align;
 		args.prod = 1;
 
+		/* Allow space for the inode btree to split */
+		args.minleft = igeo->inobt_maxlevels;
 		args.minlen = igeo->ialloc_min_blks;
 		args.maxlen = args.minlen;