diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-01-06 17:13:26 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-03-25 17:08:51 -0700 |
commit | 28878e5403868560460fac087e9d828a36fa5a61 (patch) | |
tree | d0575f2de2fbf42bb34d7c75d7cf0f6e4b4f1121 /fs/xfs | |
parent | 9b10a2a18bc97bf51d8ad42684ccb0e12f59bc71 (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/xfs')
-rw-r--r-- | fs/xfs/xfs_rtalloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index ddf41d3daf8a..299eb1c77384 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c @@ -28,6 +28,7 @@ #include "xfs_error.h" #include "xfs_quota.h" #include "xfs_rtrmap_btree.h" +#include "xfs_rtrefcount_btree.h" /* * Read and return the summary information for a given extent size, @@ -925,6 +926,12 @@ xfs_growfs_check_rt_maxlevels( return -EINVAL; } + if (xfs_sb_version_hasrtreflink(&mp->m_sb)) { + new = xfs_rtrefcountbt_compute_maxlevels(mp, dblocks, rblocks); + if (new > mp->m_rtrefc_maxlevels) + return -EINVAL; + } + return 0; } |