mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yingjie Gao <gaoyingjie@uniontech.com>
To: linux-xfs@vger.kernel.org
Cc: cem@kernel.org, djwong@kernel.org, linux-kernel@vger.kernel.org,
	Yingjie Gao <gaoyingjie@uniontech.com>
Subject: [PATCH v2 1/2] xfs: fix error returns in CoW fork repair
Date: Wed, 27 May 2026 11:39:01 +0800	[thread overview]
Message-ID: <20260527033902.1524007-2-gaoyingjie@uniontech.com> (raw)
In-Reply-To: <20260527033902.1524007-1-gaoyingjie@uniontech.com>

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.

Fixes: dbbdbd008632 ("xfs: repair problems in CoW forks")
Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
---
 fs/xfs/scrub/cow_repair.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/xfs/scrub/cow_repair.c b/fs/xfs/scrub/cow_repair.c
index bffc4666ce60..d23238830216 100644
--- a/fs/xfs/scrub/cow_repair.c
+++ b/fs/xfs/scrub/cow_repair.c
@@ -303,15 +303,13 @@ xrep_cow_find_bad(
 	    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;
 	}
 
 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-27  3:39 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   ` Yingjie Gao [this message]
2026-05-27  3:39   ` [PATCH v2 2/2] xfs: fix rtgroup cleanup in CoW fork repair 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
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=20260527033902.1524007-2-gaoyingjie@uniontech.com \
    --to=gaoyingjie@uniontech.com \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --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

all inboxes | Powered by JetHome®