linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 3/4] xfs_repair: refactor attr root block pointer check
Date: Tue, 04 Feb 2020 16:46:28 -0800	[thread overview]
Message-ID: <158086358798.2079557.6562544272527988911.stgit@magnolia> (raw)
In-Reply-To: <158086356778.2079557.17601708483399404544.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

In process_longform_attr, replace the agcount check with a call to the
fsblock verification function in libxfs.  Now we can also catch blocks
that point to static FS metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 repair/attr_repair.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


diff --git a/repair/attr_repair.c b/repair/attr_repair.c
index 9a44f610..7b26df33 100644
--- a/repair/attr_repair.c
+++ b/repair/attr_repair.c
@@ -980,21 +980,21 @@ process_longform_attr(
 	*repair = 0;
 
 	bno = blkmap_get(blkmap, 0);
-
-	if ( bno == NULLFSBLOCK ) {
+	if (bno == NULLFSBLOCK) {
 		if (dip->di_aformat == XFS_DINODE_FMT_EXTENTS &&
 				be16_to_cpu(dip->di_anextents) == 0)
 			return(0); /* the kernel can handle this state */
 		do_warn(
 	_("block 0 of inode %" PRIu64 " attribute fork is missing\n"),
 			ino);
-		return(1);
+		return 1;
 	}
+
 	/* FIX FOR bug 653709 -- EKN */
-	if (mp->m_sb.sb_agcount < XFS_FSB_TO_AGNO(mp, bno)) {
+	if (!xfs_verify_fsbno(mp, bno)) {
 		do_warn(
 	_("agno of attribute fork of inode %" PRIu64 " out of regular partition\n"), ino);
-		return(1);
+		return 1;
 	}
 
 	bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),


  parent reply	other threads:[~2020-02-05  0:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  0:46 [PATCH 0/4] xfsprogs: random fixes Darrick J. Wong
2020-02-05  0:46 ` [PATCH 1/4] libxfs: re-sort libxfs_api_defs.h defines Darrick J. Wong
2020-02-05  2:11   ` Chaitanya Kulkarni
2020-02-05  5:28   ` Allison Collins
2020-02-17 13:45   ` Christoph Hellwig
2020-02-05  0:46 ` [PATCH 2/4] libfrog: remove libxfs.h dependencies in fsgeom.c and linux.c Darrick J. Wong
2020-02-05  5:28   ` Allison Collins
2020-02-17 13:46   ` Christoph Hellwig
2020-02-05  0:46 ` Darrick J. Wong [this message]
2020-02-05  5:28   ` [PATCH 3/4] xfs_repair: refactor attr root block pointer check Allison Collins
2020-02-13 23:14   ` Eric Sandeen
2020-02-14  4:24     ` Darrick J. Wong
2020-02-17 13:47   ` Christoph Hellwig
2020-02-05  0:46 ` [PATCH 4/4] xfs_repair: don't corrupt a attr fork da3 node when clearing forw/back Darrick J. Wong
2020-02-05  5:29   ` Allison Collins
2020-02-05  5:59     ` Darrick J. Wong
2020-02-17 13:48   ` Christoph Hellwig

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=158086358798.2079557.6562544272527988911.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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).