Skip to content

Commit 06f3ef6

Browse files
author
Darrick J. Wong
committed
xfs: don't deplete the reserve pool when trying to shrink the fs
Every now and then, xfs/168 fails with this logged in dmesg: Reserve blocks depleted! Consider increasing reserve pool size. EXPERIMENTAL online shrink feature in use. Use at your own risk! Per-AG reservation for AG 1 failed. Filesystem may run out of space. Per-AG reservation for AG 1 failed. Filesystem may run out of space. Error -28 reserving per-AG metadata reserve pool. Corruption of in-memory data (0x8) detected at xfs_ag_shrink_space+0x23c/0x3b0 [xfs] (fs/xfs/libxfs/xfs_ag.c:1007). Shutting down filesystem. It's silly to deplete the reserved blocks pool just to shrink the filesystem, particularly since the fs goes down after that. Fixes: fb2fc17 ("xfs: support shrinking unused space in the last AG") Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 858fd16 commit 06f3ef6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fs/xfs/xfs_fsops.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,13 @@ xfs_growfs_data_private(
140140
return -EINVAL;
141141
}
142142

143-
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata,
144-
(delta > 0 ? XFS_GROWFS_SPACE_RES(mp) : -delta), 0,
145-
XFS_TRANS_RESERVE, &tp);
143+
if (delta > 0)
144+
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata,
145+
XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE,
146+
&tp);
147+
else
148+
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, -delta, 0,
149+
0, &tp);
146150
if (error)
147151
return error;
148152

0 commit comments

Comments
 (0)