xfs: fix bnobt repair space reservation disposal failure

LOLLM complains that we don't bubble failures from xrep_abt_dispose_one
upwards in the callstack.  A failure to clean up the space used (or
reserved but not used) by the new bnobt/cntbt should be reported.

Cc: stable@vger.kernel.org # v6.8
Fixes: 4bdfd7d157 ("xfs: repair free space btrees")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Darrick J. Wong 2026-09-01 22:44:52 -07:00 committed by Carlos Maiolino
parent 365fe37e10
commit c83d1ef97e

View File

@ -571,7 +571,7 @@ xrep_abt_dispose_one(
* allocation, and blocks that didn't get used can be freed via the usual
* (deferred) means.
*/
STATIC void
STATIC int
xrep_abt_dispose_reservations(
struct xrep_abt *ra,
int error)
@ -582,9 +582,13 @@ xrep_abt_dispose_reservations(
goto junkit;
list_for_each_entry_safe(resv, n, &ra->new_bnobt.resv_list, list) {
error = xrep_abt_dispose_one(ra, resv);
if (error)
int error2 = xrep_abt_dispose_one(ra, resv);
if (error2) {
if (!error)
error = error2;
goto junkit;
}
}
junkit:
@ -596,6 +600,7 @@ xrep_abt_dispose_reservations(
xrep_newbt_cancel(&ra->new_bnobt);
xrep_newbt_cancel(&ra->new_cntbt);
return error;
}
/* Retrieve free space data for bulk load. */
@ -801,7 +806,9 @@ xrep_abt_build_new_trees(
goto err_newbt;
/* Dispose of any unused blocks and the accounting information. */
xrep_abt_dispose_reservations(ra, error);
error = xrep_abt_dispose_reservations(ra, error);
if (error)
return error;
return xrep_roll_ag_trans(sc);
@ -812,8 +819,7 @@ xrep_abt_build_new_trees(
xfs_btree_del_cursor(cnt_cur, error);
xfs_btree_del_cursor(bno_cur, error);
err_newbt:
xrep_abt_dispose_reservations(ra, error);
return error;
return xrep_abt_dispose_reservations(ra, error);
}
/*