]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: fix sparse inode limits on runt AG
authorDave Chinner <dchinner@redhat.com>
Wed, 13 Nov 2024 10:11:20 +0000 (11:11 +0100)
committerCarlos Maiolino <cem@kernel.org>
Fri, 22 Nov 2024 10:24:40 +0000 (11:24 +0100)
commit13325333582d4820d39b9e8f63d6a54e745585d9
treeb16703c8705550f5ec8eb6a08cf338f242d8315e
parent652f03db897ba24f9c4b269e254ccc6cc01ff1b7
xfs: fix sparse inode limits on runt AG

The runt AG at the end of a filesystem is almost always smaller than
the mp->m_sb.sb_agblocks. Unfortunately, when setting the max_agbno
limit for the inode chunk allocation, we do not take this into
account. This means we can allocate a sparse inode chunk that
overlaps beyond the end of an AG. When we go to allocate an inode
from that sparse chunk, the irec fails validation because the
agbno of the start of the irec is beyond valid limits for the runt
AG.

Prevent this from happening by taking into account the size of the
runt AG when allocating inode chunks. Also convert the various
checks for valid inode chunk agbnos to use xfs_ag_block_count()
so that they will also catch such issues in the future.

Fixes: 56d1115c9bc7 ("xfs: allocate sparse inode chunks on full chunk allocation failure")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/libxfs/xfs_ialloc.c