* [PATCHSET 0/1] xfs: fix growfsrt failure during rt volume attach
@ 2023-12-07 2:23 Darrick J. Wong
2023-12-07 2:29 ` [PATCH 1/1] xfs: recompute growfsrtfree transaction reservation while growing rt volume Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2023-12-07 2:23 UTC (permalink / raw)
To: chandanbabu, hch, djwong; +Cc: linux-xfs
Hi all,
One more series to fix a transaction reservation overrun while
trying to attach a very large rt volume to a filesystem.
If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.
This has been lightly tested with fstests. Enjoy!
Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=fix-growfsrt-failures-6.8
---
fs/xfs/xfs_rtalloc.c | 5 +++++
1 file changed, 5 insertions(+)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] xfs: recompute growfsrtfree transaction reservation while growing rt volume
2023-12-07 2:23 [PATCHSET 0/1] xfs: fix growfsrt failure during rt volume attach Darrick J. Wong
@ 2023-12-07 2:29 ` Darrick J. Wong
2023-12-07 5:06 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2023-12-07 2:29 UTC (permalink / raw)
To: chandanbabu, hch, djwong; +Cc: linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
While playing with growfs to create a 20TB realtime section on a
filesystem that didn't previously have an rt section, I noticed that
growfs would occasionally shut down the log due to a transaction
reservation overflow.
xfs_calc_growrtfree_reservation uses the current size of the realtime
summary file (m_rsumsize) to compute the transaction reservation for a
growrtfree transaction. The reservations are computed at mount time,
which means that m_rsumsize is zero when growfs starts "freeing" the new
realtime extents into the rt volume. As a result, the transaction is
undersized and fails.
Fix this by recomputing the transaction reservations every time we
change m_rsumsize.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_rtalloc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 8feb58c6241c..0c9893b9f2a9 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1038,6 +1038,9 @@ xfs_growfs_rt(
nrsumblocks = xfs_rtsummary_blockcount(mp, nrsumlevels,
nsbp->sb_rbmblocks);
nmp->m_rsumsize = nrsumsize = XFS_FSB_TO_B(mp, nrsumblocks);
+ /* recompute growfsrt reservation from new rsumsize */
+ xfs_trans_resv_calc(nmp, &nmp->m_resv);
+
/*
* Start a transaction, get the log reservation.
*/
@@ -1124,6 +1127,8 @@ xfs_growfs_rt(
*/
mp->m_rsumlevels = nrsumlevels;
mp->m_rsumsize = nrsumsize;
+ /* recompute growfsrt reservation from new rsumsize */
+ xfs_trans_resv_calc(mp, &mp->m_resv);
error = xfs_trans_commit(tp);
if (error)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] xfs: recompute growfsrtfree transaction reservation while growing rt volume
2023-12-07 2:29 ` [PATCH 1/1] xfs: recompute growfsrtfree transaction reservation while growing rt volume Darrick J. Wong
@ 2023-12-07 5:06 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-12-07 5:06 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: chandanbabu, hch, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-07 5:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-07 2:23 [PATCHSET 0/1] xfs: fix growfsrt failure during rt volume attach Darrick J. Wong
2023-12-07 2:29 ` [PATCH 1/1] xfs: recompute growfsrtfree transaction reservation while growing rt volume Darrick J. Wong
2023-12-07 5:06 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox