]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: error out when a superblock buffer update reduces the agcount
authorChristoph Hellwig <hch@lst.de>
Mon, 14 Oct 2024 06:04:53 +0000 (08:04 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 22 Oct 2024 11:37:18 +0000 (13:37 +0200)
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 <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf_item_recover.c

index edf1162a8c9dd0d0d7c4056e9990ebd6cf0269f1..a839ff5dcaa908b6531abb15a6717c061e54782f 100644 (file)
@@ -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.