Skip to content

xfs: short circuit xfs_growfs_data_private() if delta is zero

Merge Request Required Information

Summary of Changes

xfs: short circuit xfs_growfs_data_private() if delta is zero

JIRA: https://issues.redhat.com/browse/RHEL-21392 Tested: with reproducer

commit 84712492e6dab803bf595fb8494d11098b74a652 Author: Eric Sandeen sandeen@redhat.com Date: Thu Dec 14 13:28:08 2023 -0600

    xfs: short circuit xfs_growfs_data_private() if delta is zero

    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.)

    Fixes: fb2fc1720185 ("xfs: support shrinking unused space in the last AG")
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
    Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>

Signed-off-by: Andrey Albershteyn aalbersh@redhat.com

Approved Development Ticket

All submissions to CentOS Stream must reference an approved ticket in Red Hat Jira. Please follow the CentOS Stream contribution documentation for how to file this ticket and have it approved.

Edited by Andrey Albershteyn

Merge request reports