]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: check that the rtrefcount maxlevels doesn't increase when growing fs
authorDarrick J. Wong <djwong@kernel.org>
Fri, 9 Aug 2024 13:18:18 +0000 (15:18 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 12 Aug 2024 11:53:09 +0000 (13:53 +0200)
The size of filesystem transaction reservations depends on the maximum
height (maxlevels) of the realtime btrees.  Since we don't want a grow
operation to increase the reservation size enough that we'll fail the
minimum log size checks on the next mount, constrain growfs operations
if they would cause an increase in the rt refcount btree maxlevels.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_fsops.c
fs/xfs/xfs_rtalloc.c

index f8505e1b2bafa3beb4ac800b77fe11d7ef6a7844..42d03d91fbf1255c27805168222f85ff313a4164 100644 (file)
@@ -23,6 +23,7 @@
 #include "xfs_trace.h"
 #include "xfs_rtalloc.h"
 #include "xfs_rtrmap_btree.h"
+#include "xfs_rtrefcount_btree.h"
 
 /*
  * Write new AG headers to disk. Non-transactional, but need to be
@@ -235,6 +236,7 @@ xfs_growfs_data_private(
 
                /* Compute new maxlevels for rt btrees. */
                xfs_rtrmapbt_compute_maxlevels(mp);
+               xfs_rtrefcountbt_compute_maxlevels(mp);
        }
 
        return error;
index e2c793fb1974d0f100c093e66b7ba97254deb63a..8bcab5ed050c6ccb6b5836350cfe3b05ce95535f 100644 (file)
@@ -911,6 +911,7 @@ xfs_growfs_rt_bmblock(
         */
        mp->m_features |= XFS_FEAT_REALTIME;
        xfs_rtrmapbt_compute_maxlevels(mp);
+       xfs_rtrefcountbt_compute_maxlevels(mp);
 
        kfree(nmp);
        return 0;
@@ -1118,6 +1119,7 @@ xfs_growfs_check_rtgeom(
                nmp->m_features |= XFS_FEAT_REALTIME;
 
        xfs_rtrmapbt_compute_maxlevels(nmp);
+       xfs_rtrefcountbt_compute_maxlevels(nmp);
        xfs_trans_resv_calc(nmp, M_RES(nmp));
 
        /*