summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:18:47 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-09-17 18:55:24 -0700
commitf5c693ab5b76003b2bf6e9e4712a27d31065557e (patch)
tree31a648f1c2cb6ef5ed41d1ee4a8c72c7b802a4af /fs
parentd188f4469e4270c5addc340e322333d99f3fddd2 (diff)
xfs: check that the rtrefcount maxlevels doesn't increase when growing fs
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_rtalloc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 4548d23f60d0..ac86a201666e 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -924,6 +924,12 @@ xfs_growfs_check_rt_maxlevels(
return -EINVAL;
}
+ if (xfs_has_rtreflink(mp)) {
+ new = xfs_rtrefcountbt_compute_maxlevels(mp, dblocks, rblocks);
+ if (new > mp->m_rtrefc_maxlevels)
+ return -EINVAL;
+ }
+
return 0;
}