linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 1/6] xfs: fix perag loop in xchk_bmap_check_rmaps
Date: Sun, 02 Oct 2022 11:20:08 -0700	[thread overview]
Message-ID: <166473480888.1083927.912685328486215875.stgit@magnolia> (raw)
In-Reply-To: <166473480864.1083927.11062319917293302327.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

sparse complains that we can return an uninitialized error from this
function and that pag could be uninitialized.  We know that there are no
zero-AG filesystems and hence we had to call xchk_bmap_check_ag_rmaps at
least once, so this is not actually possible, but I'm too worn out from
automated complaints from unsophisticated AIs so let's just fix this and
move on to more interesting problems, eh?

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/bmap.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)


diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
index 576c02cc8b8f..63e43fd8af5d 100644
--- a/fs/xfs/scrub/bmap.c
+++ b/fs/xfs/scrub/bmap.c
@@ -602,14 +602,14 @@ xchk_bmap_check_rmaps(
 
 	for_each_perag(sc->mp, agno, pag) {
 		error = xchk_bmap_check_ag_rmaps(sc, whichfork, pag);
-		if (error)
-			break;
-		if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
-			break;
+		if (error ||
+		    (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) {
+			xfs_perag_put(pag);
+			return error;
+		}
 	}
-	if (pag)
-		xfs_perag_put(pag);
-	return error;
+
+	return 0;
 }
 
 /*


  reply	other threads:[~2022-10-02 18:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02 18:20 [PATCHSET v23.1 0/6] xfs: strengthen file mapping scrub Darrick J. Wong
2022-10-02 18:20 ` Darrick J. Wong [this message]
2022-10-14  4:45   ` [PATCH 1/6] xfs: fix perag loop in xchk_bmap_check_rmaps Dave Chinner
2022-10-02 18:20 ` [PATCH 4/6] xfs: check quota files for unwritten extents Darrick J. Wong
2022-10-14  5:10   ` Dave Chinner
2022-10-02 18:20 ` [PATCH 2/6] xfs: teach scrub to check for adjacent bmaps when rmap larger than bmap Darrick J. Wong
2022-10-14  4:50   ` Dave Chinner
2022-10-02 18:20 ` [PATCH 5/6] xfs: check that CoW fork extents are not shared Darrick J. Wong
2022-10-14  5:08   ` Dave Chinner
2022-10-02 18:20 ` [PATCH 6/6] xfs: teach scrub to flag non-extents format cow forks Darrick J. Wong
2022-10-14  5:08   ` Dave Chinner
2022-10-02 18:20 ` [PATCH 3/6] xfs: block map scrub should handle incore delalloc reservations Darrick J. Wong
2022-10-14  5:07   ` Dave Chinner

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=166473480888.1083927.912685328486215875.stgit@magnolia \
    --to=djwong@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;
as well as URLs for NNTP newsgroup(s).