xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()

Replace ASSERT(sum > 0) with an XFS_IS_CORRUPT() and place it just
after the call to xfs_rtget_summary() so that we don't end up using
an illegal value of sum.

Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Nirjhar Roy (IBM) 2026-02-04 20:36:26 +05:30 committed by Carlos Maiolino
parent 6de23f81a5
commit 18c16f602a

View File

@ -112,6 +112,10 @@ xfs_rtcopy_summary(
error = xfs_rtget_summary(oargs, log, bbno, &sum);
if (error)
goto out;
if (XFS_IS_CORRUPT(oargs->mp, sum < 0)) {
error = -EFSCORRUPTED;
goto out;
}
if (sum == 0)
continue;
error = xfs_rtmodify_summary(oargs, log, bbno, -sum);
@ -120,7 +124,6 @@ xfs_rtcopy_summary(
error = xfs_rtmodify_summary(nargs, log, bbno, sum);
if (error)
goto out;
ASSERT(sum > 0);
}
}
error = 0;