]> 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>
Mon, 23 Sep 2024 20:42:41 +0000 (13:42 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 9 Oct 2024 13:55:50 +0000 (15:55 +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 e892d08d57d3766befbeaf4a71e7ffb9095e2a2f..fcf4fd41886198a2297fb31ef6def6bea29232bf 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
@@ -233,6 +234,7 @@ xfs_growfs_data_private(
 
                /* Compute new maxlevels for rt btrees. */
                xfs_rtrmapbt_compute_maxlevels(mp);
+               xfs_rtrefcountbt_compute_maxlevels(mp);
        }
 
        return error;
index f9e988a5014d4c23effd27ab44e481fdf8f03b9c..08cdac5d85513729c0019fe0f88f4d7fa3bd9cc9 100644 (file)
@@ -994,6 +994,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;
@@ -1176,6 +1177,7 @@ xfs_growfs_check_rtgeom(
        nmp->m_sb.sb_dblocks = dblocks;
 
        xfs_rtrmapbt_compute_maxlevels(nmp);
+       xfs_rtrefcountbt_compute_maxlevels(nmp);
        xfs_trans_resv_calc(nmp, M_RES(nmp));
 
        /*