From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: Christoph Hellwig <hch@lst.de>, linux-xfs@vger.kernel.org
Subject: [PATCH 09/17] xfs_repair: complain about bad interior btree pointers
Date: Mon, 01 Jun 2020 21:25:58 -0700 [thread overview]
Message-ID: <159107195896.313760.2369698179955785000.stgit@magnolia> (raw)
In-Reply-To: <159107190111.313760.8056083399475334567.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
Actually complain about garbage btree node pointers, don't just silently
ignore them.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
libxfs/libxfs_api_defs.h | 1 +
repair/scan.c | 55 +++++++++++++++++++++++++++++++++-------------
2 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
index 4462036b..7b264ff2 100644
--- a/libxfs/libxfs_api_defs.h
+++ b/libxfs/libxfs_api_defs.h
@@ -180,6 +180,7 @@
#define xfs_trans_roll_inode libxfs_trans_roll_inode
#define xfs_trans_roll libxfs_trans_roll
+#define xfs_verify_agbno libxfs_verify_agbno
#define xfs_verify_cksum libxfs_verify_cksum
#define xfs_verify_dir_ino libxfs_verify_dir_ino
#define xfs_verify_ino libxfs_verify_ino
diff --git a/repair/scan.c b/repair/scan.c
index fff54ecf..719ad035 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -779,6 +779,14 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
for (i = 0; i < numrecs; i++) {
xfs_agblock_t agbno = be32_to_cpu(pp[i]);
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
+ do_warn(
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
+ agbno, name, agno, bno);
+ suspect++;
+ return;
+ }
+
/*
* XXX - put sibling detection right here.
* we know our sibling chain is good. So as we go,
@@ -788,10 +796,8 @@ _("%s freespace btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
* pointer mismatch, try and extract as much data
* as possible.
*/
- if (agbno != 0 && verify_agbno(mp, agno, agbno)) {
- scan_sbtree(agbno, level, agno, suspect, scan_allocbt,
- 0, magic, priv, ops);
- }
+ scan_sbtree(agbno, level, agno, suspect, scan_allocbt, 0,
+ magic, priv, ops);
}
}
@@ -1234,10 +1240,16 @@ _("%s rmap btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
continue;
}
- if (agbno != 0 && verify_agbno(mp, agno, agbno)) {
- scan_sbtree(agbno, level, agno, suspect, scan_rmapbt, 0,
- magic, priv, ops);
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
+ do_warn(
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
+ agbno, name, agno, bno);
+ suspect++;
+ return;
}
+
+ scan_sbtree(agbno, level, agno, suspect, scan_rmapbt, 0, magic,
+ priv, ops);
}
out:
@@ -1454,10 +1466,16 @@ _("extent (%u/%u) len %u claimed, state is %d\n"),
for (i = 0; i < numrecs; i++) {
xfs_agblock_t agbno = be32_to_cpu(pp[i]);
- if (agbno != 0 && verify_agbno(mp, agno, agbno)) {
- scan_sbtree(agbno, level, agno, suspect, scan_refcbt, 0,
- magic, priv, ops);
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
+ do_warn(
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
+ agbno, name, agno, bno);
+ suspect++;
+ return;
}
+
+ scan_sbtree(agbno, level, agno, suspect, scan_refcbt, 0, magic,
+ priv, ops);
}
out:
if (suspect)
@@ -2125,11 +2143,18 @@ _("%sbt btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
}
for (i = 0; i < numrecs; i++) {
- if (be32_to_cpu(pp[i]) != 0 && verify_agbno(mp, agno,
- be32_to_cpu(pp[i])))
- scan_sbtree(be32_to_cpu(pp[i]), level, agno,
- suspect, scan_inobt, 0, magic, priv,
- ops);
+ xfs_agblock_t agbno = be32_to_cpu(pp[i]);
+
+ if (!libxfs_verify_agbno(mp, agno, agbno)) {
+ do_warn(
+ _("bad btree pointer (%u) in %sbt block %u/%u\n"),
+ agbno, name, agno, bno);
+ suspect++;
+ return;
+ }
+
+ scan_sbtree(be32_to_cpu(pp[i]), level, agno, suspect,
+ scan_inobt, 0, magic, priv, ops);
}
}
next prev parent reply other threads:[~2020-06-02 4:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 4:25 [PATCH v2 00/17] xfs_repair: catch things that xfs_check misses Darrick J. Wong
2020-06-02 4:25 ` [PATCH 01/17] xfs_quota: fix unsigned int id comparisons Darrick J. Wong
2020-06-19 13:32 ` Christoph Hellwig
2020-06-02 4:25 ` [PATCH 02/17] xfs_repair: fix missing dir buffer corruption checks Darrick J. Wong
2020-06-02 4:25 ` [PATCH 03/17] xfs_repair: warn when we would have rebuilt a directory Darrick J. Wong
2020-06-02 4:25 ` [PATCH 04/17] xfs_repair: check for AG btree records that would wrap around Darrick J. Wong
2020-06-02 4:25 ` [PATCH 05/17] xfs_repair: fix bnobt and refcountbt record order checks Darrick J. Wong
2020-06-02 4:25 ` [PATCH 06/17] xfs_repair: check for out-of-order inobt records Darrick J. Wong
2020-06-02 4:25 ` [PATCH 07/17] xfs_repair: fix rmapbt record order check Darrick J. Wong
2020-06-02 4:25 ` [PATCH 08/17] xfs_repair: tag inobt vs finobt errors properly Darrick J. Wong
2020-06-02 4:25 ` Darrick J. Wong [this message]
2020-06-02 4:26 ` [PATCH 10/17] xfs_repair: convert to libxfs_verify_agbno Darrick J. Wong
2020-06-02 4:26 ` [PATCH 11/17] xfs_repair: refactor verify_dfsbno_range Darrick J. Wong
2020-06-02 4:26 ` [PATCH 12/17] xfs_repair: remove verify_dfsbno Darrick J. Wong
2020-06-02 4:26 ` [PATCH 13/17] xfs_repair: remove verify_aginum Darrick J. Wong
2020-06-02 4:26 ` [PATCH 14/17] xfs_repair: mark entire free space btree record as free1 Darrick J. Wong
2020-06-02 4:26 ` [PATCH 15/17] xfs_repair: complain about free space only seen by one btree Darrick J. Wong
2020-06-02 4:26 ` [PATCH 16/17] xfs_repair: complain about extents in unknown state Darrick J. Wong
2020-06-02 4:26 ` [PATCH 17/17] xfs_repair: complain about any nonzero inprogress value, not just 1 Darrick J. Wong
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=159107195896.313760.2369698179955785000.stgit@magnolia \
--to=darrick.wong@oracle.com \
--cc=hch@lst.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.