xfs: short circuit xfs_growfs_data_private() if delta is zero
PATCH 1/1 xfs: short circuit xfs_growfs_data_private() if delta is zero
From: Eric Sandeen <[email protected]>
[ Upstream commit 84712492e6dab803bf595fb8494d11098b74a652 ]
Although xfs_growfs_data() doesn't call xfs_growfs_data_private() if in->newblocks == mp->m_sb.sb_dblocks, xfs_growfs_data_private() further massages the new block count so that we don't i.e. try to create a too-small new AG.
This may lead to a delta of "0" in xfs_growfs_data_private(), so we end up in the shrink case and emit the EXPERIMENTAL warning even if we're not changing anything at all.
Fix this by returning straightaway if the block delta is zero.
(nb: in older kernels, the result of entering the shrink case with delta == 0 may actually let an -ENOSPC escape to userspace, which is confusing for users.)
---
Greg,
This fixes fstests failure in xfs/606.
The upstream fix applies cleanly to 5.15.y and was already backported to 6.6.y and 6.1.y by Leah:
https://lore.kernel.org/linux-xfs/[email protected]/
Wasn't sure if you'd prefer to keep Leah's SOB and Darrick's ACK from the 6.1.y backport, so did not keep them.
This is tested and running on our production 5.15 kernel for a while.
Thanks,
Amir.
fs/xfs/xfs_fsops.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/xfs/xfs_fsops.c +4 -0
@@ -126,6 +126,10 @@ xfs_growfs_data_private(if (delta <0 && nagcount <2 )return -EINVAL ; +/* No work to do */ +if (delta ==0 ) +return 0 ; + oagcount = mp->m_sb.sb_agcount;/* allocate the new per-ag structures */
Signature · 1 line
2.47.1