Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Yingjie Gao <gaoyingjie@uniontech.com>
Cc: linux-xfs@vger.kernel.org, cem@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] xfs: fix error returns in CoW fork repair
Date: Wed, 27 May 2026 21:44:42 -0700	[thread overview]
Message-ID: <20260528044442.GA6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260527043134.1550710-2-gaoyingjie@uniontech.com>

On Wed, May 27, 2026 at 12:31:33PM +0800, Yingjie Gao wrote:
> xrep_cow_find_bad() returns success after the cleanup labels even if
> AG setup, btree queries, or bitmap updates failed. This can make
> repair continue with an incomplete bad-file-offset bitmap instead of
> stopping at the original error.
> 
> The force-rebuild path has a related cleanup problem. If
> xrep_cow_mark_file_range() fails, the function returns directly and
> skips the scrub AG context and perag cleanup.
> 
> Let the force-rebuild path fall through to the existing cleanup code
> and return the saved error after cleanup.
> 

Cc: <stable@vger.kernel.org> # v6.8

(please make life easier for Theodorics A and B who are half-assing LTS
QA these days)

> Fixes: dbbdbd008632 ("xfs: repair problems in CoW forks")
> Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
> ---
>  fs/xfs/scrub/cow_repair.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/scrub/cow_repair.c b/fs/xfs/scrub/cow_repair.c
> index bffc4666ce60..a6ff09ace43d 100644
> --- a/fs/xfs/scrub/cow_repair.c
> +++ b/fs/xfs/scrub/cow_repair.c
> @@ -300,18 +300,15 @@ xrep_cow_find_bad(
>  	 * on the debugging knob, replace everything in the CoW fork.
>  	 */
>  	if ((sc->sm->sm_flags & XFS_SCRUB_IFLAG_FORCE_REBUILD) ||
> -	    XFS_TEST_ERROR(sc->mp, XFS_ERRTAG_FORCE_SCRUB_REPAIR)) {
> +	    XFS_TEST_ERROR(sc->mp, XFS_ERRTAG_FORCE_SCRUB_REPAIR))
>  		error = xrep_cow_mark_file_range(xc, xc->irec.br_startblock,
>  				xc->irec.br_blockcount);
> -		if (error)
> -			return error;

I personally would have stuck with the v1 logic of turning that into a
"goto out_sa" but either way is correct.

With the cc tag added,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D


> -	}
>  
>  out_sa:
>  	xchk_ag_free(sc, &sc->sa);
>  out_pag:
>  	xfs_perag_put(pag);
> -	return 0;
> +	return error;
>  }
>  
>  /*
> -- 
> 2.20.1
> 
> 

  reply	other threads:[~2026-05-28  4:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 12:32 [PATCH 0/2] xfs: fix CoW fork repair error handling Yingjie Gao
2026-05-26 12:32 ` [PATCH 1/2] xfs: fix error returns in CoW fork repair Yingjie Gao
2026-05-26 14:52   ` Carlos Maiolino
2026-05-26 12:32 ` [PATCH 2/2] xfs: fix rtgroup cleanup " Yingjie Gao
2026-05-26 14:53   ` Carlos Maiolino
2026-05-26 14:51 ` [PATCH 0/2] xfs: fix CoW fork repair error handling Carlos Maiolino
2026-05-27  3:38   ` Yingjie Gao
2026-05-27  3:39 ` [PATCH v2 " Yingjie Gao
2026-05-27  3:39   ` [PATCH v2 1/2] xfs: fix error returns in CoW fork repair Yingjie Gao
2026-05-27  3:39   ` [PATCH v2 2/2] xfs: fix rtgroup cleanup " Yingjie Gao
2026-05-27  4:31   ` [PATCH v3 0/2] xfs: fix CoW fork repair error handling Yingjie Gao
2026-05-27  4:31     ` [PATCH v3 1/2] xfs: fix error returns in CoW fork repair Yingjie Gao
2026-05-28  4:44       ` Darrick J. Wong [this message]
2026-05-28  8:08         ` Carlos Maiolino
2026-05-27  4:31     ` [PATCH v3 2/2] xfs: fix rtgroup cleanup " Yingjie Gao
2026-05-28  4:45       ` Darrick J. Wong
2026-05-30  6:40     ` [PATCH v3 0/2] xfs: fix CoW fork repair error handling Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260528044442.GA6078@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=gaoyingjie@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox