From: Christoph Hellwig Date: Mon, 14 Oct 2024 06:04:53 +0000 (+0200) Subject: xfs: error out when a superblock buffer update reduces the agcount X-Git-Tag: v6.12-rc5~6^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b882b0f8138ffa935834e775953f1630f89bbb62;p=thirdparty%2Flinux.git xfs: error out when a superblock buffer update reduces the agcount XFS currently does not support reducing the agcount, so error out if a logged sb buffer tries to shrink the agcount. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Signed-off-by: Carlos Maiolino --- diff --git a/fs/xfs/xfs_buf_item_recover.c b/fs/xfs/xfs_buf_item_recover.c index edf1162a8c9dd..a839ff5dcaa90 100644 --- a/fs/xfs/xfs_buf_item_recover.c +++ b/fs/xfs/xfs_buf_item_recover.c @@ -713,6 +713,11 @@ xlog_recover_do_primary_sb_buffer( */ xfs_sb_from_disk(&mp->m_sb, dsb); + if (mp->m_sb.sb_agcount < orig_agcount) { + xfs_alert(mp, "Shrinking AG count in log recovery not supported"); + return -EFSCORRUPTED; + } + /* * Initialize the new perags, and also update various block and inode * allocator setting based off the number of AGs or total blocks.