Re: [PATCH 1/2] xfs: fix error returns in CoW fork repair
From: Carlos Maiolino
Date: Tue May 26 2026 - 11:29:38 EST
On Tue, May 26, 2026 at 08:32:42PM +0800, Yingjie Gao wrote:
> The non-realtime CoW fork repair scan returns success after the
> common cleanup labels, even if the AG setup, btree queries, or bitmap
> updates failed. This can make online repair continue with an
> incomplete bad-file-offset bitmap instead of stopping at the original
> error.
>
> The force-rebuild path has the opposite cleanup problem: if marking
> the entire mapping fails, it returns directly and skips the scrub AG
> context and perag reference cleanup.
>
> Send force-rebuild failures through the existing cleanup label and
> return the saved error from the function. Successful scans still
> return zero.
>
> Fixes: dbbdbd008632 ("xfs: repair problems in CoW forks")
> Signed-off-by: Yingjie Gao <gaoyingjie@xxxxxxxxxxxxx>
> ---
> fs/xfs/scrub/cow_repair.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/scrub/cow_repair.c b/fs/xfs/scrub/cow_repair.c
> index bffc4666ce60..bc3838bac71a 100644
> --- a/fs/xfs/scrub/cow_repair.c
> +++ b/fs/xfs/scrub/cow_repair.c
> @@ -304,14 +304,14 @@ xrep_cow_find_bad(
> error = xrep_cow_mark_file_range(xc, xc->irec.br_startblock,
> xc->irec.br_blockcount);
> if (error)
> - return error;
> + goto out_sa;
> }
The goto here is pointless as it jumps to the very next line, it could
simply let the code fall through.
>
> out_sa:
> xchk_ag_free(sc, &sc->sa);
> out_pag:
> xfs_perag_put(pag);
> - return 0;
> + return error;
> }
>
> /*
> --
> 2.20.1
>
>