Re: [PATCH 2/2] xfs: fix rtgroup cleanup in CoW fork repair
From: Carlos Maiolino
Date: Tue May 26 2026 - 11:00:14 EST
On Tue, May 26, 2026 at 08:32:43PM +0800, Yingjie Gao wrote:
> The realtime CoW fork repair scan initializes scrub rtgroup state
> before it checks whether the whole mapping should be rebuilt. That
> state includes realtime btree cursors, rtgroup locks, and an extra
> sr->rtg reference.
>
> If marking the full mapping fails in the force-rebuild path, the code
> jumps directly to out_rtg. That only drops the local rtgroup reference
> and skips the scrub rtgroup cleanup, leaving the cursors, lock, and
> sr->rtg reference behind.
>
> Jump to out_sr instead so this error path matches the other failures
> after xrep_rtgroup_init().
>
> Fixes: fd97fe111208 ("xfs: fix CoW forks for realtime files")
> Signed-off-by: Yingjie Gao <gaoyingjie@xxxxxxxxxxxxx>
> ---
> fs/xfs/scrub/cow_repair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/scrub/cow_repair.c b/fs/xfs/scrub/cow_repair.c
> index bc3838bac71a..bff25cf74e29 100644
> --- a/fs/xfs/scrub/cow_repair.c
> +++ b/fs/xfs/scrub/cow_repair.c
> @@ -389,7 +389,7 @@ xrep_cow_find_bad_rt(
> error = xrep_cow_mark_file_range(xc, xc->irec.br_startblock,
> xc->irec.br_blockcount);
> if (error)
> - goto out_rtg;
> + goto out_sr;
Ditto for this patch.
> }
>
> out_sr:
> --
> 2.20.1
>
>